diff options
Diffstat (limited to 'macros/latex/contrib')
153 files changed, 6892 insertions, 1228 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index ef77b1dd23..94cecae2dc 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -15,7 +15,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2024/01/14}{2024H} +\ProvidesExplClass{easybook}{2024/01/16}{2024I} {Easily typesetting Chinese theses or books} \bool_set_false:N \l__eb_compile_draft_bool @@ -158,7 +158,7 @@ \eb_setsansfont:nn { Arial } { } \eb_setmonofont:nn { Courier~New } { } } -\cs_new_protected:Npn \eb_font_load_libertinus_sans: +\cs_new_protected:Npn \eb@font@load@libertinus@sans { \eb_setsansfont:nn { LibertinusSans } { @@ -168,7 +168,7 @@ ItalicFont = *-Italic } } -\cs_new_protected:Npn \eb_font_load_lmmonolt_mono: +\cs_new_protected:Npn \eb@font@load@lmmonolt@mono { \eb_setmonofont:nn { lmmonolt10 } { @@ -189,8 +189,8 @@ ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic } - \eb_font_load_libertinus_sans: - \eb_font_load_lmmonolt_mono: + \eb@font@load@libertinus@sans + \eb@font@load@lmmonolt@mono } \cs_new_protected:Npn \eb@font@load@libertine { @@ -202,8 +202,8 @@ ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic } - \eb_font_load_libertinus_sans: - \eb_font_load_lmmonolt_mono: + \eb@font@load@libertinus@sans + \eb@font@load@lmmonolt@mono } \cs_new_protected:Npn \eb@font@load@palatino { @@ -215,8 +215,8 @@ ItalicFont = *-italic, BoldItalicFont = *-bolditalic } - \eb_font_load_libertinus_sans: - \eb_font_load_lmmonolt_mono: + \eb@font@load@libertinus@sans + \eb@font@load@lmmonolt@mono } \cs_new_protected:Npn \eb_put_newtxmath:n #1 { \PassOptionsToPackage{#1}{newtxmath} } @@ -302,7 +302,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2024/01/14}{2024H} +\ProvidesExplPackage{easybase}{2024/01/16}{2024I} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -1245,7 +1245,6 @@ \cs_set:Npn \thebisection { \eb_section_counter_prefix:n { bi } } \cs_set:Npn \thebisubsection { \thebisection.\@arabic\c@bisubsection } \cs_set:Npn \thesection { \eb_section_counter_prefix:n { } } -\contentsuse{}{tec} \tl_new:N \eb@before@addbitoc@hook \NewDocumentCommand{\BeforeAddBitoc}{sm} { @@ -1390,8 +1389,13 @@ } \cs_new_protected:Npn \eb_toc_title_level_cmd:n #1 { - \IfBooleanF{#1} - {\eb@toc@title@level{\eb@toc@title}{\eb@bitoc@title}} + \IfBooleanTF{#1} + {\par} + { + \tl_if_exist:NTF \eb@toc@title + { \eb@toc@title@level{\eb@toc@title}{\eb@bitoc@title} } + { \par } + } } \cs_new_protected:Npn \eb_toc_float_list_parse:nnnnn #1#2#3#4#5 { @@ -1499,7 +1503,7 @@ \tl_use:c { l__eb_toc_#1_after_tl } } } -\cs_new_protected:Npn \RegisterTocName #1 +\cs_new_protected:Npn \eb@toc@format@define #1 { \ctex_define:n { @@ -1511,6 +1515,9 @@ #1/tocafter .tl_set:c = l__eb_toc_#1_after_tl, #1/tocbelow .tl_set:c = l__eb_toc_#1_below_tl } + } +\cs_new_protected:Npn \eb@toc@format@initial #1 + { \titlecontents{#1} [\dim_use:c { l__eb_toc_#1_indent_dim }] {\tl_use:c { l__eb_toc_#1_format_tl }} @@ -1518,8 +1525,20 @@ {\tl_use:c { l__eb_toc_#1_rule_tl }} [\tl_use:c { l__eb_toc_#1_below_tl }] } +\cs_new_protected:Npn \RegisterTocName #1 + { + \eb@toc@format@define{#1} + \eb@toc@format@initial{#1} + } \seq_map_function:NN \c__ctex_headings_seq \RegisterTocName +\seq_remove_all:Nn \c__ctex_headings_seq { table } +\seq_remove_all:Nn \c__ctex_headings_seq { figure } +\seq_remove_all:Nn \c__ctex_headings_seq { lstlisting } +\cs_new_protected:Npn \eb@key@path@meta@define #1 + { \ctex_define:n { #1 .meta:nn = { ctex/#1 } {##1} } } +\seq_map_function:NN +\c__ctex_headings_seq \eb@key@path@meta@define \eb_seq_map_inline:nn { tocformat,tocformat+,tocformat~+, @@ -1586,6 +1605,14 @@ } } } +\cs_set_eq:NN \eb@ctexsetii \ctex_set:nn +\cs_new_protected:Npn \SetTocStyle #1#2#3 + { + \tl_set:cn { eb@toc@style@set@#1@#2 } + { \eb@ctexsetii{#1}{#3} } + } +\cs_new_protected:Npn \UseTocStyle #1#2#3 + { \addtocontents{#3}{\@nameuse{eb@toc@style@set@#1@#2}} } \ctex_set:n { part = @@ -2321,7 +2348,7 @@ } %</package> %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2024/01/14}{2024H} +\ProvidesExplFile{eb-tcolorbox.cfg}{2024/01/16}{2024I} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf Binary files differindex 9538d1c7cf..a0fea3d113 100644 --- a/macros/latex/contrib/easybook/easybook.pdf +++ b/macros/latex/contrib/easybook/easybook.pdf diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 1dbe185ff6..d0df41762e 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -23,8 +23,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK使用手册, - version = v2024H, - date = 2024/01/14, + version = v2024I, + date = 2024/01/16, authors = 瞿毅, info = 简便地排版中文学位论文或书籍, email = toquyi@163.com, @@ -558,7 +558,7 @@ \keyval{numberlike}{计数器} 定理将使用此 \meta{计数器} 进行编号,通常这是另一个定理环境的名称。 \keyval{qed}{证毕符号} - 证毕符号。位于定理段落末尾行的右侧边缘,可以设置成 \cs{qedsymbol} 默认是空心方块。 + 证毕符号。位于定理段落末尾行的版心右边,可以设置成 \cs{qedsymbol} 默认是空心方块。 \keyval{style}{定理样式} 选项的值为使用 \cs{declaretheoremstyle} 命令新定义的定理样式。 @@ -681,7 +681,7 @@ \begin{commands} \command{markrule}[\oarg{长度}\darg{颜色名}\marg{线宽}\baroarg{上间距,下间距}] - 实线命令 \cs{markrule} 既可在 \meta{横线命令} 中用于绘制页眉页脚横线,也可以在正文中使用。\meta{长度} 默认为页面文本区的宽度,上下间距为横线与上下方部件的间距,带有长度单位,上下间距之间用符号 \code{|} 分开,若只有一部分则表示 \meta{上间距}。下面举一个设置页眉内容的例子: + 实线命令 \cs{markrule} 既可在 \meta{横线命令} 中用于绘制页眉页脚横线,也可以在正文中使用。\meta{长度} 默认为版心的宽度,上下间距为横线与上下方部件的间距,带有长度单位,上下间距之间用符号 \code{|} 分开,若只有一部分则表示 \meta{上间距}。下面举一个设置页眉内容的例子: \begin{ctexexam} \ebhdrset{headrule = \markrule(DarkOrchid){0.5pt}[2pt|2pt]} \fancyhead[ER]{\leftmark} @@ -810,10 +810,10 @@ \end{commands} \keyval{tocafter}{距离命令}\dtag\Default{\cs*{hspace}\Marg{1em}} 目录条目标签与标题间的代码,默认为插入 \code{1em} 横向距离。 - \keyval{tocbelow}{距离命令}\dtag\newtag% + \keyval{tocbelow}{距离命令}\dtag 在目录条目下方执行的代码,可以插入垂直距离等命令。 \keyval{tocline}{条目定义}\dtag[\textcolor{red}{\ding{73}}] - 这个选项在章节标题基础上扩展了浮动环境的题注在目录文件中的定义。选项中参数 \code{\#1} 代表相应题注编号 \cs*{the}\meta{计数器} 的值,参数 \code{\#2} 代表相应题注内容。 + 这个选项在章节标题基础上扩展了浮动环境的题注标题在目录文件中的定义。由于设计的原因,章节标题选项中参数 \code{\#1} 代表标题编号 \cs*{the}\meta{计数器} 对应的计数器名称,而题注标题选项中参数 \code{\#1} 代表标题编号 \cs*{the}\meta{计数器} 的值,章节和题注标题中参数 \code{\#2} 均代表相应标题内容。 \begin{ctexexam} \ctexset { @@ -830,11 +830,11 @@ \end{options} \begin{commands} - \command{RegisterTocName}[\marg{条目名}]\newtag% + \command{RegisterTocName}[\marg{条目名}] 给条目类型名称为 \meta{条目名} 的标题注册用于设置目录样式的选项,即选项前有符号 \ding{73} 表示需要注册后使用。前面提到的条目类型均已注册,需要注意新类型的条目注册后选项初始值\textbf{均为空}。 \command{contentsuse}[\marg{条目名}\marg{扩展名}] 激活条目类型名称为 \meta{条目名} 的目录定制功能,它使用的目录文件后缀为 \meta{扩展名}。需要在激活条目后再使用命令 \cs{RegisterTocName} 注册选项。 - \command{DeclareFloatList}[\marg{条目名}\marg{扩展名}]\newtag% + \command{DeclareFloatList}[\marg{条目名}\marg{扩展名}] 声明一种条目类型的目录命令 \cs*{listof}\meta{条目名}\code{\textcolor{cs}{s}},并且支持\ref{subsec:directory command} 中图表目录命令的机制。使用这个命令要确保将条目加入目录的机制已经存在,例如搭配 \pkg*{newfloat} 宏包创建新的浮动环境。选项前有红色符号 \textcolor{red}{\ding{73}}(仍包含黑色符号选项的性质)表示在声明后可用。下面举一个声明算法环境和对应题注目录的例子: \begin{ctexexam} \usepackage{newfloat} @@ -846,6 +846,14 @@ \DeclareFloatList{algorithm}{loa} \listofalgorithms[multoc] % 在正文中输出双栏算法目录 \end{ctexexam} + \command{SetTocStyle}[\marg{条目名}\marg{风格名}\marg{键值列表}]\newtag% + 定义条目类型名称为 \meta{风格名} 的目录风格。使用 \cs*{ctexset} 命令设置目录样式时,除了条目标题定义选项 \option{tocline},其它选项只有在目录输出命令前设置才有效,定义完目录风格后用 \cs{UseTocStyle} 命令可以在正文中任意位置生效。如果是没有 \ding{73} 符号的选项,\meta{条目名} 设置为 \module*{tocset}。 + \command{UseTocStyle}[\marg{条目名}\marg{风格名}\marg{扩展名}]\newtag% + 使用对应条目类型名称为 \meta{风格名} 的目录风格,随后标题在目录中的格式会改变。本命令导言区和正文区均可使用,第三个必选参数还需要指定条目标题加入目录文件的 \meta{扩展名}。 + \begin{ctexexam} + \SetTocStyle{chapter}{fancy}{tocformat = \color{red}\zihao{3}} + \UseTocStyle{chapter}{fancy}{toc} + \end{ctexexam} \command{listnumberline}[\marg{条目名}] 在图表等浮动环境的题注目录中插入条目标签,默认标签的名字可以由格式命令 \cs{labelformat} 设置。注意其中 \meta{条目名} 需要用对应名称\textbf{显式指定}。 \begin{ctexexam} @@ -855,6 +863,8 @@ lstlisting/tocline = \protect\numberline{代码#1\hspace{1em}}#2 } \end{ctexexam} + \command{contentsmargin}[\marg{右边距}] + 目录中引导线到版心右边的距离,用于条目页码的精细调整。当设置条目页码对齐方式或数字较大时,可以设置适当的数值,可在导言区全局设置或在 \option{tocformat} 选项给条目类型单独设置。 \end{commands} \begin{options} @@ -864,7 +874,7 @@ 代码目录中每章第一个条目上方增加的垂直距离。与 \CTeX 的表格和图片目录中每章间的条目距离选项 \option*{lotskip} 和 \option*{lofskip} 类似,在 \cls*{article} 模式中此选项失效。 \keyval{between}{代码钩子}\dtag[\textcolor{red}{\ding{73}}] 目录标题与条目内容间的钩子(作用于标题下方间距之后),一般插入负的垂直距离代码用于抵消目录首行额外的垂直间距。除了条目名的键路径外,此选项也可用于 \module*{tocset} 路径中,表示章节标题目录标题代码钩子。 - \keyval{bibetween}{代码钩子}\newtag% + \keyval{bibetween}{代码钩子} 与选项 \option{between} 类似,是英文章节标题目录(如果启用)标题代码钩子。 \keychoice{dotalign}{\fbox{true},false} 引导线选项 \option{dotalign} 可以使目录引导线右端对齐并与页码保持一定间距,否则会与页码相连。 @@ -963,9 +973,9 @@ \command{appendix}[\splitoarg{前名字,后名字}\darg{编号输出命令}] 附录起始命令,其后的章节标题变为附录形式。\meta{前名字} 为英文目录中附录标题的前名字,同理 \meta{后名字} 为英文目录中附录标题的后名字。前后名字之间用一个半角逗号分开,也可以只有一部分,表示英文目录中附录标题前名字。\meta{编号输出命令} 为附录标题计数器在英文目录中的编号命令。注意这两个参数仅对 \code{bichapter} 级别的标题生效。 \command{BeforeAddBitoc}[\sarg\marg{英文标题加入目录前的代码}] - 作用于局部范围的英文目录钩子,可以插入标题或目录设置的命令改变英文目录中标题的显示格式,也可以覆盖上述的目录前后名字和编号等设置,带有星号的命令会重置之前的代码,放置在导言区或 \cs{bichapter} 等双语标题命令前生效。这个命令在设置英文目录标题格式中有最高优先级。举一个在英文目录节标题编号前添加 \code{Section} 字符串的例子: + 作用于局部范围的英文目录章节标题钩子,代码在标题加入目录前执行,可以插入条目标题定义命令临时改变英文目录中条目的格式,带有星号参数的命令会重置之前的代码。这个命令设置英文目录条目的标题格式具有最高优先级,放置在导言区或 \cs{bichapter} 等双语标题命令前生效。举一个在英文目录节标题编号前添加 \code{Section} 字符串的例子: \begin{ctexexam} - \BeforeAddBitoc{\ctexset{section/name = Section}} + \BeforeAddBitoc{\ctexset{section/name = Section\space}} \bisection{zhtitle}{entitle} \end{ctexexam} \end{commands} @@ -1340,9 +1350,10 @@ \shortversion{v = 1.638,date = 2022/03/04,changes = 增加目录条目样式选项注册命令 \cs{RegisterTocName}。} \shortversion{v = 1.644,date = 2022/03/10,changes = 增加浮动环境目录声明命令 \cs{DeclareFloatList} 配合 \pkg*{caption} 宏包。} \shortversion{v = 1.682,date = 2022/05/01,changes = 将迷你页判断命令 \cs{notminipage} 改为被保护命令兼容 \pkg*{circledtext} 宏包。} - \begin{version}[v = 2024H,date = 2024/01/14,simple] + \begin{version}[v = 2024I,date = 2024/01/16,simple] \item 核对依赖宏包的更新改动,优化使用手册的内容细节。 \item 修复图表题注目录中条目标签编号的计数器值显示错误问题。 + \item 新增目录风格定义命令 \cs{SetTocStyle} 和使用命令 \cs{UseTocStyle}。 \end{version} \end{changelog} \nocite{*} diff --git a/macros/latex/contrib/ppt-slides/DEPENDS.txt b/macros/latex/contrib/ppt-slides/DEPENDS.txt index 9234b174c7..d0c2464766 100644 --- a/macros/latex/contrib/ppt-slides/DEPENDS.txt +++ b/macros/latex/contrib/ppt-slides/DEPENDS.txt @@ -18,6 +18,7 @@ hard tikzpagenodes hard titling hard varwidth hard xcolor +hard listings soft acmart soft biber soft biblatex diff --git a/macros/latex/contrib/ppt-slides/LICENSE.txt b/macros/latex/contrib/ppt-slides/LICENSE.txt index 5744f745f0..1f211e0287 100644 --- a/macros/latex/contrib/ppt-slides/LICENSE.txt +++ b/macros/latex/contrib/ppt-slides/LICENSE.txt @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2021-2023 Yegor Bugayenko +Copyright (c) 2021-2024 Yegor Bugayenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal diff --git a/macros/latex/contrib/ppt-slides/README.md b/macros/latex/contrib/ppt-slides/README.md index 3827f11588..f1f92da99d 100644 --- a/macros/latex/contrib/ppt-slides/README.md +++ b/macros/latex/contrib/ppt-slides/README.md @@ -25,7 +25,7 @@ and then use in preamble: \end{document} ``` -Otherwise, you can download [`ppt-slides.sty`](https://raw.githubusercontent.com/yegor256/ppt-slides/gh-pages/ppt-slides/ppt-slides.sty) and add to your project. +Otherwise, you can download [`ppt-slides.sty`](https://yegor256.github.io/ppt-slides/ppt-slides.sty) and add to your project. If you want to contribute yourself, make a fork, then create a branch, then run `l3build ctan` in the root directory. diff --git a/macros/latex/contrib/ppt-slides/ppt-slides.dtx b/macros/latex/contrib/ppt-slides/ppt-slides.dtx index 54abab106f..9e14a1170d 100644 --- a/macros/latex/contrib/ppt-slides/ppt-slides.dtx +++ b/macros/latex/contrib/ppt-slides/ppt-slides.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % (The MIT License) % -% Copyright (c) 2021-2023 Yegor Bugayenko +% Copyright (c) 2021-2024 Yegor Bugayenko % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the 'Software'), to deal @@ -50,7 +50,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{ppt-slides} %<*package> -[2023-11-08 0.3.0 Slide Decks a la Power Point] +[2024-01-16 0.3.1 Slide Decks a la Power Point] %</package> %<*driver> \documentclass{ltxdoc} @@ -410,18 +410,77 @@ \fi\makeatother % \end{macrocode} -% Then, we include a few packages: +% Then, we include \href{https://ctan.org/pkg/ifthen}{ifthen} +% in order to enable |if/then/else| commands: % \begin{macrocode} -\RequirePackage{ifthen} % for if/then/else in LaTeX -\RequirePackage{href-ul} % for nice hyperlinks -\RequirePackage{pagecolor} % to change page color -\RequirePackage{varwidth} % for pptWide -\RequirePackage{qrcode} % to print QR codes -\RequirePackage{tikz} % for drawings in TOC - \usetikzlibrary{calc} % for positioning of pinned boxes -\RequirePackage{tikzpagenodes} % for pptPin -\RequirePackage[inline]{enumitem} % for lists in crumbs -\RequirePackage{crumbs} % for crumbs +\RequirePackage{ifthen} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/href-ul}{href-ul} +% in order to enable underlined hyperlinks: +% \begin{macrocode} +\RequirePackage{href-ul} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/pagecolor}{pagecolor} +% in order to make it possible to change the background color of a page: +% \begin{macrocode} +\RequirePackage{pagecolor} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/varwidth}{varwidth} +% in order to change the width of the page, inside |pptWide|: +% \begin{macrocode} +\RequirePackage{varwidth} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/qrcode}{qrcode} +% in order to render QR codes: +% \begin{macrocode} +\RequirePackage{qrcode} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/tikz}{tikz} +% in order to position elements on the page, especially in the Table of Contents: +% \begin{macrocode} +\RequirePackage{tikz} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/tikzpagenodes}{tikzpagenodes} +% in order to pin a block in |\pptPin|: +% \begin{macrocode} +\RequirePackage{tikzpagenodes} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/enumitem}{enumitem} +% in order to render inline lists in crumbs: +% \begin{macrocode} +\RequirePackage[inline]{enumitem} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/crumbs}{crumbs} +% in order to show top-page menus: +% \begin{macrocode} +\RequirePackage{crumbs} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/calc}{calc} +% in order to calculate positions of elements more precisely: +% \changes{0.3.1}{2024/01/13}{The \texttt{calc} package added.} +% \begin{macrocode} +\RequirePackage{calc} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/tabularx}{tabularx} +% in order to render |\pptQuote|: +% \begin{macrocode} +\RequirePackage{tabularx} +% \end{macrocode} + +% Then, we include \href{https://ctan.org/pkg/seqsplit}{seqsplit} +% in order to split long links: +% \begin{macrocode} +\RequirePackage{seqsplit} % \end{macrocode} % \begin{macro}{\pptMiddle} @@ -536,7 +595,6 @@ % Then, we define the |\pptQuote| command, with one optional and three mandatory arguments: % \changes{0.3.0}{2023/11/08}{The \texttt{\char`\\pptQuote} command has got an optional parameter, where the name of the person on the photo can be specified.} % \begin{macrocode} -\RequirePackage{tabularx} \newcommand\pptQuote[4][]{% \begin{tabularx}{\columnwidth}{c>{\raggedright\arraybackslash}X}% \raisebox{\dimexpr-\height+\ht\strutbox}{ @@ -654,7 +712,6 @@ % \begin{macro}{\pptPinQR} % Then, we define the |\pptPinQR| command: % \begin{macrocode} -\RequirePackage{seqsplit} \newcommand\pptPinQR[2][right]{% \pptPin[#1]{% \begin{minipage}{1.4in}% @@ -682,14 +739,12 @@ % \end{macrocode} % \end{macro} +% \begin{macrocode} \endinput +% \end{macrocode} % \Finale -% \clearpage -% \printbibliography -% \clearpage - % \PrintChanges % \clearpage % \PrintIndex diff --git a/macros/latex/contrib/ppt-slides/ppt-slides.ins b/macros/latex/contrib/ppt-slides/ppt-slides.ins index a5f87589b0..eb3965fa10 100644 --- a/macros/latex/contrib/ppt-slides/ppt-slides.ins +++ b/macros/latex/contrib/ppt-slides/ppt-slides.ins @@ -1,6 +1,6 @@ %% (The MIT License) %% -%% Copyright (c) 2021-2023 Yegor Bugayenko +%% Copyright (c) 2021-2024 Yegor Bugayenko %% %% Permission is hereby granted, free of charge, to any person obtaining a copy %% of this software and associated documentation files (the 'Software'), to deal @@ -26,7 +26,7 @@ \preamble (The MIT License) -Copyright (c) 2021-2023 Yegor Bugayenko +Copyright (c) 2021-2024 Yegor Bugayenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal diff --git a/macros/latex/contrib/ppt-slides/ppt-slides.pdf b/macros/latex/contrib/ppt-slides/ppt-slides.pdf Binary files differindex 9e22a9e1aa..774992d89f 100644 --- a/macros/latex/contrib/ppt-slides/ppt-slides.pdf +++ b/macros/latex/contrib/ppt-slides/ppt-slides.pdf diff --git a/macros/latex/contrib/regulatory/README.md b/macros/latex/contrib/regulatory/README.md new file mode 100644 index 0000000000..ec9a283dc9 --- /dev/null +++ b/macros/latex/contrib/regulatory/README.md @@ -0,0 +1,27 @@ +# Regulatory + +A LaTeX package which provides macro's for crafting regulatory documents. + +## Installation +In order to install this package the `texmf` tree has to be copied to a directory LaTeX will search in. +Consult `tlmgr conf texmf TEXMFHOME` to get any ideas of where that should be. + +If it's favored to keep this tree separate from other LaTeX trees one can add a configuration to `/etc/texmf/texmf.d` which adds a TEXMF AUX TREE (Debian and derivatives only). +This can be useful when you need to change the source and/or push changes with Git. + +```bash +TEXMFAUXTREES=$HOME/src/regulatory/texmf, +``` +*/etc/texmf/texmf.d/01xerdi.cnf* + +Afterward execute `update-texmf` with root permissions. +It can be validated by the output of: `kpsewhich -var-value TEXMFAUXTREES`. +## Documentation +The documentation is available in Dutch and English and will be included in every release. +See the [releases page](https://github.com/Xerdi/regulatory/releases) for the PDF files. + +For more information on building all documentation, see [Makefile](Makefile) and [doc/Makefile](doc/Makefile) in this project. + +## License +This project is licensed under the LPPL version 1.3c and maintained by Erik Nijenhuis. +See [LICENSE.txt](LICENSE.txt) for more information. diff --git a/macros/latex/contrib/regulatory/doc/example.md b/macros/latex/contrib/regulatory/doc/example.md new file mode 100644 index 0000000000..9ad1a4dcae --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example.md @@ -0,0 +1,23 @@ +# Definitiones +\label{art:defs} +\glssetwidest{Nam dui} + +Lorem +: \describe{def1} +Nam dui +: \describe{def2} +Nulla +: \describe{def3} + +# Quisque ullamcorper + +1. \label{lid:lorem}\textfill +2. \label{lid:lorem2}\textfill + 1. \label{sub:lorem}\textfill~\Aref{lid:lorem}. + 2. \label{sub:lorem2}\textfill~\Aref{ex2-lid:lorem}. + 3. \label{sub:lorem3}\textfill~\Aref{lid:lorem,lid:lorem2}. + 4. \label{sub:lorem4}\textfill~\Aref{ex2-lid:lorem,ex2-lid:lorem2,ex2-lid:lorem3}. + 5. \label{sub:lorem5}\textfill~\Aref{ex2-lid:lorem,ex2-lid:lorem2,ex2-lid:lorem3,ex2-lid:lorem5}. + 6. \label{sub:lorem6}\textfill~\Gls{def1} ipsum dolor sit amed. + 7. \label{sub:lorem7}\textfill~\Aref{ex2-sub:lorem,ex2-sub:lorem2,ex2-sub:lorem4}. + 8. \label{sub:lorem8}\textfill
\ No newline at end of file diff --git a/macros/latex/contrib/regulatory/doc/example1-en.pdf b/macros/latex/contrib/regulatory/doc/example1-en.pdf Binary files differnew file mode 100644 index 0000000000..0e08431dbf --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example1-en.pdf diff --git a/macros/latex/contrib/regulatory/doc/example1-en.tex b/macros/latex/contrib/regulatory/doc/example1-en.tex new file mode 100644 index 0000000000..eeb17acc99 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example1-en.tex @@ -0,0 +1,42 @@ +%% example1-en.tex +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\documentclass[12pt,english]{article} +\usepackage{babel} +\usepackage[alldefs]{regulatory} +\usepackage{lipsum} + +\newcounter{lip} +\setcounter{lip}{1} +\newcommand\textfill{\lipsum[\arabic{lip}]\stepcounter{lip}} + +\newcommand\translation[2]{#1} + +\refdocument[ex2-]{example2-en}{% + ref label=of Example Two +} + +\loadglsdefs{example1} + +\begin{document} + \input{example1} +\end{document} diff --git a/macros/latex/contrib/regulatory/doc/example1-nl.pdf b/macros/latex/contrib/regulatory/doc/example1-nl.pdf Binary files differnew file mode 100644 index 0000000000..63522191b7 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example1-nl.pdf diff --git a/macros/latex/contrib/regulatory/doc/example1-nl.tex b/macros/latex/contrib/regulatory/doc/example1-nl.tex new file mode 100644 index 0000000000..df01669786 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example1-nl.tex @@ -0,0 +1,42 @@ +%% example1-nl.tex +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\documentclass[12pt,dutch]{article} +\usepackage{babel} +\usepackage[alldefs]{regulatory} +\usepackage{lipsum} + +\newcounter{lip} +\setcounter{lip}{1} +\newcommand\textfill{\lipsum[\arabic{lip}]\stepcounter{lip}} + +\newcommand\translation[2]{#2} + +\refdocument[ex2-]{example2-nl}{% + ref label=van Voorbeeld Twee +} + +\loadglsdefs{example1} + +\begin{document} + \input{example1} +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/regulatory/doc/example1.bib b/macros/latex/contrib/regulatory/doc/example1.bib new file mode 100644 index 0000000000..c1b0311764 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example1.bib @@ -0,0 +1,15 @@ + +@entry{def1, + name = {Lorem}, + description = {\textfill} +} + +@entry{def2, + name = {Nam dui}, + description = {\textfill} +} + +@entry{def3, + name = {Nulla}, + description = {\textfill} +} diff --git a/macros/latex/contrib/regulatory/doc/example1.tex b/macros/latex/contrib/regulatory/doc/example1.tex new file mode 100644 index 0000000000..b9e0f1331f --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example1.tex @@ -0,0 +1,25 @@ +\begin{center} + \Huge \translation{Example One}{Voorbeeld Één} +\end{center} +\article{Definitiones}\label{art:defs} +\printdefs{Nam dui} +\article{Quisque ullamcorper}\label{art:lorem} +\begin{paras} + \item \label{lid:lorem} \textfill + \item \label{lid:lorem2} \textfill + \begin{paras} + \item \label{sub:lorem} \textfill~\Aref{lid:lorem}. + \item \label{sub:lorem2} \textfill~\Aref{ex2-lid:lorem}. + \item \label{sub:lorem3} \textfill~\Aref{lid:lorem,lid:lorem2}. + \item \label{sub:lorem4} \textfill~\Aref{ex2-lid:lorem,ex2-lid:lorem2,ex2-lid:lorem3}. + \item \label{sub:lorem5} \textfill~\Aref{ex2-lid:lorem,ex2-lid:lorem2,ex2-lid:lorem3,ex2-lid:lorem5}. + \item \label{sub:lorem6} \textfill~\Gls{def1} ipsum dolor sit amed. + \item \label{sub:lorem7} \textfill~\Aref{ex2-sub:lorem,ex2-sub:lorem2,ex2-sub:lorem4}. + \item \label{sub:lorem8} \textfill + \end{paras} +\end{paras} +\article{Etiam ac leo}\label{art:lorem2} +\para{A risus tristique nonummy} +\textfill +\article{Nulla in ipsum}\label{art:lorem3} +\textfill diff --git a/macros/latex/contrib/regulatory/doc/example2-en.pdf b/macros/latex/contrib/regulatory/doc/example2-en.pdf Binary files differnew file mode 100644 index 0000000000..bc253e499b --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example2-en.pdf diff --git a/macros/latex/contrib/regulatory/doc/example2-en.tex b/macros/latex/contrib/regulatory/doc/example2-en.tex new file mode 100644 index 0000000000..f47f7d0d9e --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example2-en.tex @@ -0,0 +1,49 @@ +%% example2-en.tex +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\documentclass[12pt,english]{article} +\usepackage{babel} +\usepackage{regulatory} +\usepackage{lipsum} + +\newcounter{lip} +\setcounter{lip}{1} +\newcommand\textfill{\lipsum[\arabic{lip}]\stepcounter{lip}} + +\newcommand\translation[2]{#1} + +\newcommand\definitionlabel[1]{~(see #1)} + +\masterdocument[ex1-]{example1-en}{% + defs=example1,% + author=E. Nijenhuis,% + subject= Example One,% + description = The first example document, + footnote label = Attachment:~, + ref label=of Example One, + def label=\definitionlabel +} +\loadglsdefs{example2} + +\begin{document} + \input{example2} +\end{document} diff --git a/macros/latex/contrib/regulatory/doc/example2-nl.pdf b/macros/latex/contrib/regulatory/doc/example2-nl.pdf Binary files differnew file mode 100644 index 0000000000..be0484a77c --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example2-nl.pdf diff --git a/macros/latex/contrib/regulatory/doc/example2-nl.tex b/macros/latex/contrib/regulatory/doc/example2-nl.tex new file mode 100644 index 0000000000..071cce4a00 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example2-nl.tex @@ -0,0 +1,49 @@ +%% example2-nl.tex +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\documentclass[12pt,dutch]{article} +\usepackage{babel} +\usepackage{regulatory} +\usepackage{lipsum} + +\newcounter{lip} +\setcounter{lip}{1} +\newcommand\textfill{\lipsum[\arabic{lip}]\stepcounter{lip}} + +\newcommand\translation[2]{#2} + +\newcommand\definitionlabel[1]{~(zie #1)} + +\masterdocument[ex1-]{example1-nl}{% + defs=example1,% + author=E. Nijenhuis,% + subject= Voorbeeld Één,% + description = Het éérste voorbeeld document, + footnote label = Bijlage:~, + ref label=van Voorbeeld Één, + def label=\definitionlabel +} +\loadglsdefs{example2} + +\begin{document} + \input{example2} +\end{document} diff --git a/macros/latex/contrib/regulatory/doc/example2.bib b/macros/latex/contrib/regulatory/doc/example2.bib new file mode 100644 index 0000000000..555f4f976e --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example2.bib @@ -0,0 +1,5 @@ + +@entry{def4, + name = {Suspendisse}, + description = {\textfill} +} diff --git a/macros/latex/contrib/regulatory/doc/example2.tex b/macros/latex/contrib/regulatory/doc/example2.tex new file mode 100644 index 0000000000..4721fad59b --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/example2.tex @@ -0,0 +1,21 @@ +\begin{center} + \Huge \translation{Example Two}{Voorbeeld Twee} +\end{center} +\article{Pactum}\label{art:agreement} +\begin{paras} + \item \label{lid:lorem} \textfill~\Gls{def1}. + \item \label{lid:lorem2} \textfill~\Gls{def2}. + \item \label{lid:lorem3} \textfill + \item \label{lid:lorem4} \textfill + \item \label{lid:lorem5} \textfill~\Gls{def4} ipsum dolor sit amed.\\ + \printdefs{Suspendisse} + \begin{paras} + \item \label{sub:lorem} \textfill + \item \label{sub:lorem2} \textfill + \item \label{sub:lorem3} \textfill + \item \label{sub:lorem4} \textfill + \end{paras} +\end{paras} +\article{Suspendisse} +\para{Aliquam} +\textfill
\ No newline at end of file diff --git a/macros/latex/contrib/regulatory/doc/md-example.tex b/macros/latex/contrib/regulatory/doc/md-example.tex new file mode 100644 index 0000000000..475dc773b4 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/md-example.tex @@ -0,0 +1,24 @@ +\documentclass[12pt,dutch]{article} +\usepackage{babel} +\usepackage[md,alldefs]{regulatory} +\usepackage{lipsum} + +\newcounter{lip} +\setcounter{lip}{1} +\newcommand\textfill{\lipsum[\arabic{lip}]\stepcounter{lip}} + +\refdocument[ex2-]{example2-nl}{ + defs=example2 + ref label=van Voorbeeld Twee +} + +\loadglsdefs{example1} + +\begin{document} + \begin{center} + \Huge Voorbeeld Markdown + \end{center} + + \markdownInput{example.md} + +\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/regulatory/doc/regulatory-en.pdf b/macros/latex/contrib/regulatory/doc/regulatory-en.pdf Binary files differnew file mode 100644 index 0000000000..11f032e016 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/regulatory-en.pdf diff --git a/macros/latex/contrib/regulatory/doc/regulatory-en.tex b/macros/latex/contrib/regulatory/doc/regulatory-en.tex new file mode 100644 index 0000000000..0ec1ac52b9 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/regulatory-en.tex @@ -0,0 +1,52 @@ +%% regulatory-en.tex +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\documentclass[10pt,english]{ltxdoc} + +%! suppress = InclusionLoop +\usepackage[md]{regulatory} +\usepackage{tabularx} +\usepackage[english,dutch]{babel} + +\input{regulatory-preamble} +\newcommand\translation[2]{#1} +\masterdocument[ex1-]{example1-en}{% + defs=example1,% + author=E. Nijenhuis,% + subject= Example One,% + description = The first example document, + ref label=of Example One +} + +\masterdocument[ex2-]{example2-en}{% + defs=example2,% + author=E. Nijenhuis,% + subject= Example Two,% + description = The second example document, + ref label=of Example Two +} + +% Document +\begin{document} + \selectlanguage{english} + \input{regulatory} +\end{document} diff --git a/macros/latex/contrib/regulatory/doc/regulatory-nl.pdf b/macros/latex/contrib/regulatory/doc/regulatory-nl.pdf Binary files differnew file mode 100644 index 0000000000..334e4f3c55 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/regulatory-nl.pdf diff --git a/macros/latex/contrib/regulatory/doc/regulatory-nl.tex b/macros/latex/contrib/regulatory/doc/regulatory-nl.tex new file mode 100644 index 0000000000..af6a3e7941 --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/regulatory-nl.tex @@ -0,0 +1,63 @@ +%% regulatory-nl.tex +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\documentclass[10pt,dutch]{ltxdoc} + +%! suppress = InclusionLoop +\usepackage[md]{regulatory} +\usepackage{tabularx} +\usepackage[dutch,english]{babel} + +\input{regulatory-preamble} + +\zcRefTypeSetup{listing}{% + Name-sg = Codelijst, + name-sg = codelijst, + Name-pl = Codelijsten, + name-pl = codelijsten +} + +\renewcommand{\lstlistingname}{Codelijst} + +\newcommand\translation[2]{#2} + +\masterdocument[ex1-]{example1-nl}{% + defs=example1,% + author=E. Nijenhuis,% + subject= Voorbeeld Één,% + description = Het éérste voorbeeld document, + ref label=van Voorbeeld Één +} + +\masterdocument[ex2-]{example2-nl}{% + defs=example2,% + author=E. Nijenhuis,% + subject= Voorbeeld Twee,% + description = Het tweede voorbeeld document, + ref label=van Voorbeeld Twee +} + +% Document +\begin{document} + \selectlanguage{dutch} + \input{regulatory} +\end{document} diff --git a/macros/latex/contrib/regulatory/doc/regulatory-preamble.tex b/macros/latex/contrib/regulatory/doc/regulatory-preamble.tex new file mode 100644 index 0000000000..50c6db1bee --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/regulatory-preamble.tex @@ -0,0 +1,110 @@ +%% regulatory-preamble.tex +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\usepackage{gitinfo-lua} +\usepackage{listings} + +\usepackage{fontspec} +\usepackage{textcomp} + +\def\projecturl{https://github.com/Xerdi/regulatory} + +\definecolor{greycolor}{HTML}{BFBFBF} +\definecolor{primary}{HTML}{174A67} +\definecolor{darkcolor}{HTML}{091D28} +\definecolor{greencolor}{HTML}{176734} +\colorlet{artlabel}{primary} +\colorlet{green}{greencolor} + +\lstdefinestyle{tex}{% + language=[LaTeX]TeX, + keywordsprefix={\\}, + alsoletter={\\}, + morekeywords={article,para,textfill,masterdocument,refdocument,loadglsdefs,printdefs,setmiddleconjunction,setlastconjunction,setrangeconjunction,setconjunction,markdownInput,glssetwidest,describe} +} + +\lstdefinestyle{bash}{% + language=bash, + morekeywords={pdflatex,lualatex,latexmk,makeglossaries,bib2gls} +} + +\lstdefinelanguage{Markdown}[LaTeX]{TeX}{% + sensitive=false, + morecomment=[l][\bfseries\ttfamily\color{green}]{\#}, + morecomment=[s][\bfseries\ttfamily\color{purple}]{:\ \ }{\ }, + morestring=[s][\color{black}]{\{}{\}}, + morekeywords={article,para,textfill,masterdocument,refdocument,loadglsdefs,printdefs,setmiddleconjunction,setlastconjunction,setrangeconjunction,setconjunction,markdownInput,glssetwidest,describe}, + keywordsprefix={\\}, + alsoletter={\\}, +} + +\lstdefinestyle{md}{% + language=Markdown +} + +\lstdefinelanguage{BibTeX}{% + keywords={% + article,book,collectedbook,conference,electronic,entry,ieeetranbstctl,% + inbook,incollectedbook,incollection,injournal,inproceedings,% + manual,mastersthesis,misc,patent,periodical,phdthesis,preamble,% + proceedings,standard,string,techreport,unpublished% + }, + keywordsprefix={@}, + comment=[l][\itshape]{@comment}, + sensitive=false, +} + +\lstdefinestyle{bib}{% + language=BibTeX, + morestring=[s][\bfseries\ttfamily\color{purple}]{\ \ \ \ }{\ }, + morecomment=[n][\bfseries\ttfamily\color{green}]{\ \{}{\}}, +} + +\lstset{ + title=\lstname, + basicstyle=\ttfamily, + numberstyle=\ttfamily, + numbersep=5pt, + rulecolor=\color{greycolor}, + stringstyle=\color{pink}, + keywordstyle=\color{primary}, + commentstyle=\itshape\color{darkcolor}, + breaklines=true, + captionpos=b, + tabsize=4, + showtabs=true +} + +\newcommand\package{\texttt} +\newcommand\file{\texttt} +\newcommand\option{\texttt} + +\def\packagedate{\gitdate} +\def\packageversion{\gitversion} + +%\def\cmd{\lstinline[style=tex]} +\def\cmditem#1{\item[\ttfamily\textbackslash{}#1]} + +\newcommand\Vtextvisiblespace[1][.3em]{% + \mbox{\kern.06em\vrule height.3ex}% + \vbox{\hrule width#1}% + \hbox{\vrule height.3ex}} diff --git a/macros/latex/contrib/regulatory/doc/regulatory.tex b/macros/latex/contrib/regulatory/doc/regulatory.tex new file mode 100644 index 0000000000..ffb0ce5ecb --- /dev/null +++ b/macros/latex/contrib/regulatory/doc/regulatory.tex @@ -0,0 +1,779 @@ +%% regulatory.tex +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\translation{% + \title{Package \package{regulatory}\thanks{This document corresponds to \textsf{regulatory}~\packageversion, written on \packagedate.}} +}{% + \title{Het \package{regulatory} pakket\thanks{Dit document correspondeert aan \textsf{regulatory}~\packageversion, geschreven op \packagedate.}}% +} +\author{Erik Nijenhuis\\ +\href{mailto:erik@xerdi.com}{erik@xerdi.com}} +\date{\packagedate} +\maketitle +\begin{abstract} + % Structuur % + \translation{% + The \package{regulatory} package is well-suited for legal professionals in a broad sense. This package encompasses common structures, such as articles, sections, parts, and definitions.% + }{% + Het \package{regulatory} pakket leent zich uitstekend voor juristen in brede zin. + Dit pakket brengt veel voorkomende structuren, zoals artikelen, leden, onderdelen en definities.% + } + + % Verwijzen % + \translation{% + Referring within the legal domain can be a significant challenge; therefore, this package provides an elegant way of referencing, as one would expect with standard \LaTeX{} macros, such as for a chapter using \cmd{\section}, namely through labeling. For this purpose, the \package{regulatory} package introduces its own \cmd{\rref}, \cmd{\nref}, and \cmd{\aref} macro families that provide default support for both Dutch and English.% + }{% + Verwijzen binnen het juridisch domein kan een grote uitdaging zijn, daarom biedt dit pakket een elegante manier van verwijzen, zoals men mag verwachten bij standaard \LaTeX{} macro's, zoals voor een hoofdstuk \cmd{\section}, namelijk door middel van labelen. + Hiervoor introduceert pakket \package{regulatory} zijn eigen \cmd{\rref}, \cmd{\nref} en \cmd{\aref} macrofamilies die standaard ondersteuning bieden voor Nederlands en Engels.% + } + + % Definities % + \translation{% + Managing definitions uniformly across all documents can be achieved using \package{BibTeX}. + When it comes to referencing definitions, the \package{regulatory} package aligns with the existing \cmd{\gls} macro family of the \package{glossaries} package.% + }{% + Het beheren van definities kan eenduidig voor alle documenten met behulp van \package{BibTeX}. + Voor het verwijzen naar definities speelt het \package{regulatory} pakket in op de al bestaande \cmd{\gls} macrofamilie van \package{glossaries}.% + } + % Externe Documenten % + \translation{% + Referencing articles, sections, parts, and definitions is not limited to within a single document but can also be done from other documents written using the \package{regulatory} package. + This makes cross-referencing between documents straightforward. Consider, for example, Terms and Conditions and a Maintenance Agreement that refer to each other's articles or use each other's terms. + It is even possible to attach the Terms and Conditions as an appendix to the PDF file for completeness.% + }{% + Het verwijzen naar artikelen, leden, onderdelen en definities beperkt zich niet alleen tot één document, maar zijn ook aan te halen vanuit andere documenten geschreven met het \package{regulatory} pakket. + Op deze manier blijft het eenvoudig verwijzen voor documenten onderling. + Denk b\ij{}voorbeeld aan Algemene Voorwaarden en een Onderhoudsovereenkomst die naar elkaars artikelen verwijzen of elkaars begrippen gebruiken. + Het is zelfs mogelijk om bij documenten de Algemene Voorwaarden als bijlage in het PDF-bestand te voegen voor de volledigheid.% + } +\end{abstract} + +\clearpage +\tableofcontents +\clearpage + + +\section{\translation{Usage}{Gebruik}} +\translation{% + The \package{regulatory} package is explicitly designed for generating PDF documents with \LaTeX{}. + Therefore, use either \texttt{pdflatex} or \texttt{lualatex}.% +}{% + Het pakket \package{regulatory} is uitdrukkelijk bedoeld voor het genereren van PDF-documenten met \LaTeX{}. + Gebruik daarom \texttt{pdflatex} of \texttt{lualatex}.% +} +\begin{lstlisting}[style=tex,caption={main.tex},label=code:simple] +\documentclass[dutch]{article} +\usepackage{regulatory} +\begin{document} + \article{...} +\end{document} +\end{lstlisting} +\translation{% + The example does not use any options. This means that \option{bib2gls} is active. + To switch back to TeX code for definition lists, the option \oarg{nobibdefs} is available. + Additionally, there are options such as \oarg{md,alldefs,hidelinks,nameinlink}. + Where \option{md} activates Markdown support, \option{alldefs} lists all definitions instead of only the used definitions within the same document (useful for Terms and Conditions where not all definitions necessarily appear), \option{hidelinks} hides all colored borders of hyperlinks, and \option{nameinlink} places the hyperlink around the label.% +}{% + Het voorbeeld gebruikt geen opties. + Dit houdt in dat \option{bib2gls} actief is. + Om terug te schakelen naar TeX code voor definitielijsten is er de optie \oarg{nobibdefs}. + Verder zijn er nog de opties \oarg{md,alldefs,hidelinks,nameinlink}. + Waar \option{md} Markdown support activeert, \option{alldefs} alle definities opsomt in plaats van alleen de gebruikte definities binnen hetzelfde document (handig voor Algemene Voorwaarden waarin niet alle definities per se voorkomen), \option{hidelinks} alle gekleurde kaders van hyperlinks verbergt en \option{nameinlink} de hyperlink om het label heen plaatst.% +}\\ + +\noindent +\translation{% + The example of \zcref{code:simple} can be generated to PDF as follows:% +}{% + Het voorbeeld van \zcref{code:simple} kan als volgt gegenereerd worden naar PDF:% +} +\begin{lstlisting}[style=bash,caption={\translation{Commandline examples}{Commandline voorbeelden}}] +pdflatex main +# Or +lualatex main +# Or keep generating +latexmk -pvc -lualatex -interaction=nonstopmode main +\end{lstlisting} + +\noindent +\translation{% + Suppose definition lists are used; in that case, additional steps are added to the generation process, e.g:% +}{% + Stel er worden definitie lijsten gebruikt, dan komen er nog extra stappen bij in het generatieproces, namelijk:% +} +\begin{lstlisting}[style=Bash,caption={\translation{Commandline with definitions}{Commandline met definities}}] +lualatex main +bib2gls main +lualatex main +lualatex main +# Or for bibtex +lualatex main +makeglossaries main +lualatex main +lualatex main +\end{lstlisting} +\translation{% + In case \texttt{latexmk} is used, the command \texttt{bib2gls} or \texttt{makeglossaries} can be executed in a separate terminal. LatexMK automatically detects file changes and regenerates the document accordingly.% +}{% + In het geval gebruik gemaakt wordt van \texttt{latexmk}, dan kan er in een aparte terminal het commando \texttt{bib2gls} of \texttt{makeglossaries} gebruikt worden. + LatexMK ziet vanzelf de bestanden wijzigen en genereert dan het document opnieuw.% +} + +\clearpage + + +\section{\translation{Structure}{Structuur}}\label{sec:struct} +\translation{% + This package provides familiar structures without breaking the existing functionalities of \LaTeX{}.% +}{% + Dit pakket levert bekende structuren, zonder de bestaande functionaliteiten van \LaTeX{} te breken.% +} +\DescribeMacro{\article} +\DescribeMacro{\para} +\translation{% + For example, consider \cmd{\article}\marg{title} and \cmd{\para}\marg{title}. + These are defined as separate macros and formatted using \package{titlesec}.% +}{% + Neem b\ij{}voorbeeld \cmd{\article}\marg{title} en \cmd{\para}\marg{title}. + Deze zijn als aparte macro's gedefinieerd en opgemaakt met behulp van \package{titlesec}.% +}\\ + +\noindent +\DescribeEnv{paras} +\translation{% + For the \option{paras}\footnote{% + Originally the naming was taken from Dutch ``artikel, lid en onderdeel'', which was hard to introduce in English, due to ambiguity reasons.% + Therefore, section and part are aliased to paras.% + } and ``subparagraphs'', a new environment has been created using \package{enumitem}. + The labels for the members have been adjusted to +}{% + Voor de \option{paras} en ``onderdelen'' is een nieuwe environment aangemaakt met behulp van \package{enumitem}. + De labels van de leden zijn aangepast naar +}\lstinline[style=tex]|\thearticle.\arabic*|\translation{ + for paragraphs and +}{, voor leden en, +}\lstinline[style=tex]|\abalphnum{\arabic*)|\translation{ + for subparagraphs.% +}{, voor onderdelen.} +\translation{% + For ``subparagraphs'', \cmd{\abalpnum} from the \package{fmtcount} package is used to enumerate multiple subparagraphs. + Suppose \cmd{\alph} were used; in that case, \option{paras} (second level) would be limited to 26 subparagraphs. + With \cmd{\abalphnum}, for example, with a value of 125, the result is `\texttt{du}'. +}{% + Voor onderdelen wordt er gebruik gemaakt van \cmd{\abalpnum} uit pakket \package{fmtcount}\footnote{Het pakket \package{fmtcount} heeft geen ondersteuning voor Nederlands. Dit pakket levert daarvoor de juist configuratie mee.} om meerdere onderdelen te kunnen opsommen. + Stel er zou gebruik gemaakt worden van \cmd{\alph}, dan is \option{paras} beperkt tot 26 onderdelen. + Bij \cmd{\abalphnum} met b\ij{}voorbeeld een waarde van 125 is `\texttt{du}' de uitkomst. +} + +\begin{lstlisting}[style=tex] +\article{Voorbeeld} +\begin{paras} + \item \textfill + \begin{paras} + \item \textfill + \end{paras} + \item \textfill +\end{paras} + +\article{Voorbeeld2} +\textfill + +\para{Voorbeeld3} +\textfill +\end{lstlisting} +\translation +{See \zcref{code:example1,code:example2} for more \LaTeX{} examples.} +{Zie \zcref{code:example1,code:example2} voor meer \LaTeX{} voorbeelden.} + +\subsection{Markdown} +\translation{% + With the package option \option{md}, this package ensures that all these structures are handled. + However, this means that no chapters or other standard components can be typed. + Instead, the writer is specifically limited to the components described in this chapter. + Refer to \zcref{code:example-md} for a Markdown example, and check \zcref{code:md-example} to see how such a Markdown source can ultimately be used from within \LaTeX{}. +}{% + Met de pakketoptie \option{md} zorgt dit pakket ervoor dat al deze structuren gehanteerd worden. + Dit betekend echter wel dat er geen hoofdstukken of andere standaard onderdelen meer getypt kunnen worden. + In plaats daarvan is de schrijver juist beperkt tot de onderdelen omschreven in dit hoofdstuk. + Kijk naar \zcref{code:example-md} voor een markdown voorbeeld en naar \zcref{code:md-example} hoe zo'n Markdown bron uiteindelijk kan gebruikt worden vanuit \LaTeX{}. +} +\clearpage + + +\section{\translation{Definitions}{Definities}} +\translation{% + For referencing definitions, \package{glossaries-extra} is used. + This allows referencing with the \cmd{\gls}\marg{label} macro family.% +}{% + Voor het verwijzen naar definities wordt gebruik gemaakt van \package{glossaries-extra}. + Dit zorgt ervoor dat er met de \cmd{\gls}\marg{label} macrofamilie kan worden verwezen.% +}\\ + +\noindent +\DescribeEnv{definitions} +\DescribeEnv{externals} +\translation{% + To prevent conflicts between terms, abbreviations, and definitions, this package adds two \texttt{glossary} types. + Definitions within the same file are placed under the type \option{definitions}, while definitions from other documents are placed under \option{externals} (see \zcref{sec:extern}).% +}{% + Om conflicten tussen begrippen, afkortingen en definities te voorkomen voegt dit pakket twee \texttt{glossary} types toe. + Voor definities binnen hetzelfde bestand worden ze ingedeeld onder het type \option{definitions}, terwijl definities van andere documenten worden ingedeeld onder \option{externals} (zie \zcref{sec:extern}).% +}\\ + +\noindent +\DescribeMacro{\printdefs} +\translation{% + To list definitions, various macros have been added. + The most straightforward one, \cmd{\printdefs}\marg{width of text}, enumerates the definitions with a customized style. + The argument \marg{width of text} is provided for the alignment of definition labels and descriptions.% +}{% + Om definities in te laden zijn er twee macro's gedefinieerd. + De \cmd{\loadglsdefs}\marg{src} macro voegt BibTeX bibliotheken toe onder het type \option{definitions} en heeft als categorie \option{definitions}. + Gebruikte definities in deze bibliotheken zullen opgesomd worden wanneer \cmd{\printdefs} wordt aangeroepen. + Indien de optie \option{alldefs} bij het pakket is meegegeven, dan zullen alle definities in die bibliotheken opgesomd worden. + De opsomming wordt gesorteerd aan de hand van het Nederlandse woordenboek. + Woorden die niet voorkomen daarin zullen als eerste opgesomd worden.% +}\\ + +\noindent +\DescribeMacro{\describe} +\translation{% + To achieve the same result with \cmd{\describe}\marg{label}, it is first necessary to invoke \cmd{\glssetwidest}, for example, in Markdown (see \zcref{code:example-md}). + The \cmd{\describe} macro is well-suited for manually placing definition descriptions. + This macro adds an anchor point, required for functional hyperlinks.% +}{% + Om hetzelfde resultaat te behalen met \cmd{\describe}\marg{label} is het eerst nodig om \cmd{\glssetwidest} aan te roepen in b\ij{}voorbeeld Markdown (zie \zcref{code:example-md}). + De macro \cmd{\describe} leent zich uitstekend om handmatig definitie beschrijvingen te plaatsen. + Deze macro voegt namelijk een ankerpunt toe, vereist voor werkende hyperlinks.% +}\\ + +\noindent +\DescribeMacro{\loadglsdefs} +\translation{% + To load definitions, two macros are defined. The \cmd{\loadglsdefs}\marg{src} macro adds BibTeX libraries under the type \option{definitions} and has the category \option{definitions}. + Definitions used in these libraries will be listed when \cmd{\printdefs} is called. + If the package is given the \option{alldefs} option, then all definitions in those libraries will be listed. + The listing is sorted according to the Dutch dictionary. + Words not found in it are listed first.% +}{% + Om definities in te laden zijn er twee macro's gedefinieerd. + De \cmd{\loadglsdefs}\marg{src} macro voegt BibTeX bibliotheken toe onder het type \option{definitions} en heeft als categorie \option{definitions}. + Gebruikte definities in deze bibliotheken zullen opgesomd worden wanneer \cmd{\printdefs} wordt aangeroepen. + Als bij het pakket de optie \option{alldefs} is meegegeven, dan zullen alle definities in die bibliotheken opgesomd worden. + De opsomming wordt gesorteerd aan de hand van het Nederlandse woordenboek. + Woorden die niet voorkomen daarin worden als eerste opgesomd.% +}\\ + +\noindent +\DescribeMacro{\loadextdefs} +\translation{% + For \cmd{\loadextdefs}\oarg{category}\marg{src}, it can be useful to provide a category so that definitions from different sources can be distinguished. + However, it is unwise to call this macro directly since \cmd{\masterdocument} is already smartly handling it. +}{% + Voor \cmd{\loadextdefs}\oarg{category}\marg{src} kan het handig zijn om een categorie mee te geven, zodat definities van verschillende bronnen uit elkaar gehouden kunnen worden. + Het is echter niet aan te raden deze direct aan te roepen, aangezien \cmd{\masterdocument} hier al slim op in speelt. +} +\clearpage + + +\section{\translation{References}{Verwijzingen}} +\translation{% + For referencing articles, members, and parts, \package{zref} is used behind the scenes. + All components mentioned in \zcref{sec:struct} are configured for this purpose. + However, \package{zref} does not provide as many formatting adjustments as \package{cleveref}. +}{% + Voor het verwijzen naar artikelen, leden en onderdelen wordt onder water gebruik gemaakt van \package{zref}. + Alle onderdelen genoemd in \zcref{sec:struct} zijn hiervoor ingesteld, echter biedt \package{zref} niet zoveel formaat aanpassingen als \package{cleveref}. +} + +\DescribeMacro{\rref} +\DescribeMacro{\Rref} +\translation{% + Due to this limitation, it was decided to develop entirely new variants, including \cmd{\rref}\marg{label}. + With \cmd{\rref}, one can refer to articles just as is customary for \cmd{\section}, \cmd{\subsection}, and so on. + The \cmd{\rref} family consists of a total of four different macros:% +}{% + Door deze beperking is er voor gekozen om geheel nieuwe varianten te ontwikkelen, waaronder \cmd{\rref}\marg{label}. + Er kan dus met \cmd{\rref} verwezen worden naar artikelen net als gebruikelijk is voor \cmd{\section}, \cmd{\subsection}, en dergelijke. + De \cmd{\rref} familie kent in totaal vier verschillende macro's:% +} +\begin{labeling}{\textbackslash{}Rref*\quad} + \cmditem{rref} \translation + {Starting with a lowercase letter and with a hyperlink.} + {Beginnend met een kleine letter en met hyperlink.}\\ + \begin{tabularx}{\linewidth}{@{}X X X@{}} + \textbf{\translation{Article}{Artikel}} & \textbf{\translation{Paragraph}{Lid}} & \textbf{\translation{Subparagraph}{Onderdeel}} \\ + \rref{ex1-art:lorem} & \rref{ex1-lid:lorem} & \rref{ex1-sub:lorem} \\ + \end{tabularx} + \cmditem{rref*} \translation + {Starting with a lowercase letter and without a hyperlink.} + {Beginnend met een kleine letter en zonder hyperlink.}\\ + \begin{tabularx}{\linewidth}{@{}X X X@{}} + \textbf{\translation{Article}{Artikel}} & \textbf{\translation{Paragraph}{Lid}} & \textbf{\translation{Subparagraph}{Onderdeel}} \\ + \rref*{ex1-art:lorem} & \rref*{ex1-lid:lorem} & \rref*{ex1-sub:lorem} \\ + \end{tabularx} + \cmditem{Rref} \translation + {Starting with an uppercase letter and with a hyperlink.} + {Beginnend met een hoofdletter en met hyperlink.}\\ + \begin{tabularx}{\linewidth}{@{}X X X@{}} + \textbf{\translation{Article}{Artikel}} & \textbf{\translation{Paragraph}{Lid}} & \textbf{\translation{Subparagraph}{Onderdeel}} \\ + \Rref{ex1-art:lorem} & \Rref{ex1-lid:lorem} & \Rref{ex1-sub:lorem} \\ + \end{tabularx} + \cmditem{Rref*} \translation + {Starting with an uppercase letter and without a hyperlink.} + {Beginnend met een hoofdletter en zonder hyperlink.}\\ + \begin{tabularx}{\linewidth}{@{}X X X@{}} + \textbf{\translation{Article}{Artikel}} & \textbf{\translation{Paragraph}{Lid}} & \textbf{\translation{Subparagraph}{Onderdeel}} \\ + \Rref*{ex1-art:lorem} & \Rref*{ex1-lid:lorem} & \Rref*{ex1-sub:lorem} \\ + \end{tabularx} +\end{labeling} +\translation{% + In the examples above, a notable difference is already apparent in the alternative \cmd{\zref}, namely the presentation of the reference number/letter/word and a distinct type in the title. + For instance, for \texttt{ex1-lid:lorem}, the title is '2.1,' and it is referenced as '(1)'.% +}{% + In de voorbeelden hierboven is al een opmerkelijk verschil te zien tussen alternatief \cmd{\zref}, namelijk de presentatie van de/het verwijsnummer/letter/woord en een afwijkend type in de titel. + B\ij{}voorbeeld voor \texttt{ex1-lid:lorem} is de titel `2.1' en wordt aangehaald met `eerste'.% +}\\ + +\noindent +\DescribeMacro{\nref} +\DescribeMacro{\Nref} +\translation{% + To reference with the corresponding designation, the macro family \cmd{\nref}\marg{label} has been developed. + This family, like \cmd{\rref}, has four variants. + In the following example, for simplicity, we'll only consider \cmd{\Nref}.% +}{% + Om te verwijzen met de bijbehorende benaming is er de macrofamilie \cmd{\nref}\marg{label} ontwikkeld. + Deze familie heeft net als \cmd{\rref} vier varianten. + In het volgende voorbeeld gaan we voor het gemak alleen uit van \cmd{\Nref}.% +}\\ + +\noindent +\begin{tabularx}{\linewidth}{@{}p{\widthof{EN}} X X X@{}} + & \textbf{\translation{Article}{Artikel}} & \textbf{\translation{Paragraph}{Lid}} & \textbf{\translation{Subparagraph}{Onderdeel}} \\ + \translation{EN}{NL} & \Nref{ex1-art:lorem} & \Nref{ex1-lid:lorem} & \Nref{ex1-sub:lorem} \\ +\end{tabularx}\translation{\selectlanguage{dutch}}{\selectlanguage{english}}\\ +\begin{tabularx}{\linewidth}{@{}p{\widthof{EN}} X X X@{}} + \translation{NL}{EN} & \Nref{ex1-art:lorem} & \Nref{ex1-lid:lorem} & \Nref{ex1-sub:lorem}\\ +\end{tabularx}\translation{\selectlanguage{english}}{\selectlanguage{dutch}}\\ + +\noindent +\translation{% + A notable difference with the alternative \cmd{\zcref} is that \cmd{\nref} can take into account the position of the designation. + For example, consider the outcome for the subparagraph (\meta{written ordinal} \meta{designation}).% +}{% + Een opmerkelijk verschil tussen het alternatief \cmd{\zcref} is dat \cmd{\nref} rekening kan houden met de positie van de benaming. + Kijk bijvoorbeeld naar de uitkomst van het lid (\meta{geschreven ordinaal} \meta{benoeming}).% +}\\ + +\noindent +\translation{% + With the macro families \cmd{\rref} and \cmd{\nref}, a lot is already possible; however, there are still many other factors to consider when it comes to referencing. + For example, the \cmd{\nref} macro already includes the correct designation, but when referring to a member, the corresponding article is not mentioned.% +}{% + Met de macrofamilies \cmd{\rref} en \cmd{\nref} is er dus al veel mogelijk, echter zijn er nog veel andere factoren die meespelen als het gaat om verwijzen. + Macro \cmd{\nref} doet bijvoorbeeld wel al de juiste benaming erbij, maar bij het verwijzen naar een lid wordt er geen bijbehorend artikel genoemd.% +} +\DescribeMacro{\aref} +\DescribeMacro{\Aref} +\translation{% + For complete and automatic references, the \cmd{\aref}\marg{labels...} has been developed. + This macro family records all components of the reference. + Additionally, \cmd{\aref} accepts multiple labels and connects them in the correct way. + This can result in a list enumeration, such as \aref{ex1-sub:lorem,ex1-sub:lorem3,ex1-sub:lorem4}, or a range, like \aref{ex1-sub:lorem,ex1-sub:lorem2,ex1-sub:lorem3,ex1-sub:lorem4}. + However, there is one limitation: the \option{nameinlink} option cannot be applied when multiple labels are provided. This limitation does not apply when only one label is given. + Another additional feature is that these references are easily translatable into Dutch:% +}{% + Voor volledige en automatische verwijzingen is de \cmd{\aref}\marg{labels...} ontwikkeld. + Deze macrofamilie noteert dus alle onderdelen van de verwijzing. + Daarnaast accepteert \cmd{\aref} meerdere labels en koppelt het de labels op de juiste manier. + Dit kan een lijst opsomming geven, zoals \aref{ex1-sub:lorem,ex1-sub:lorem3,ex1-sub:lorem4}, of een reeks, zoals \aref{ex1-sub:lorem,ex1-sub:lorem2,ex1-sub:lorem3,ex1-sub:lorem4}. + Hierop is alleen één tekortkoming, namelijk, de optie \option{nameinlink} kan niet toegepast worden wanneer er meerdere labels meegegeven worden. + Deze tekortkoming geldt niet wanneer er één label wordt meegegeven. + Een andere bijkomstigheid is dat deze verwijzingen gemakkelijk te vertalen zijn naar het Engels:% +}\\ +\begin{lstlisting}[style=tex] +\selectlanguage{dutch} / \selectlanguage{english} +Zie / See \aref{ex1-sub:lorem,ex1-sub:lorem3,ex1-sub:lorem4} +en / and \aref{ex1-sub:lorem,ex1-sub:lorem2,ex1-sub:lorem3,ex1-sub:lorem4}. +\end{lstlisting}% +\translation{\selectlanguage{dutch}}{\selectlanguage{english}}~\\ +\vspace*{-4em} +\begin{center} + \large + \translation{Zie}{See} \aref{ex1-sub:lorem,ex1-sub:lorem3,ex1-sub:lorem4} + \translation{en}{and} \aref{ex1-sub:lorem,ex1-sub:lorem2,ex1-sub:lorem3,ex1-sub:lorem4}. +\end{center} +\translation{\selectlanguage{english}}{\selectlanguage{dutch}} +\translation{The only limitation that arises is that the reference name for the document isn't translated. +}{De enige beperking die optreedt is dat de verwijsnaam voor het document niet vertaald is.} + +\subsection{\translation{Conjunction}{Conjunctie}} +\DescribeMacro{\setmiddleconjunction\\\marg{format}} +\DescribeMacro{\setlastconjunction} +\DescribeMacro{\setrangeconjunction} +\DescribeMacro{\setconjunction\\\marg{middle}\\\marg{last}\\\marg{range}\\} +\translation{% + The linking of labels is done through \package{zref}. + However, thanks to the reimplementation, other macros have been written in a similar way as \package{cleveref} does, i.e:% +}{% + Het koppelen van de labels gebeurt via \package{zref}. + Er zijn echter dankzij de herimplementatie andere macro's geschreven op een vergelijkbare manier als \package{cleveref} dat doet, namelijk:% +} +\begin{lstlisting}[style=tex] +\setmiddleconjunction}{, } +\setlastconjunction}{ \GetTranslation{and} } +\setrangeconjunction}{ \GetTranslation{to} } +\setconjunction{, }{ \GetTranslation{and} }{ \GetTranslation{to} } +\end{lstlisting} +\DescribeMacro{\setjuncto} +\DescribeMacro{\unsetjuncto} +\translation{% + There are also macros to easily switch to legacy notation. + With \cmd{\setjuncto}, one can switch throughout the document to the conjunction word `\texttt{ jo.\textbackslash\ }'. + Using \cmd{\unsetjuncto} restores \cmd{\lastconjunction} back to `\texttt{ and }'. + If manual changes have been made to the conjunctions earlier, those changes will be overridden by one of these macros. + In that case, use \cmd{\setlastconjunction}\marg{value} instead of \cmd{\unsetjuncto}. +}{% + Er zijn ook macro's om gemakkelijk naar verouderde notatie te schakelen. + Met \cmd{\setjuncto} kan er willekeurig in het document omgeschakeld worden naar het koppelwoord `\texttt{ jo.\textbackslash\ }'. + Door \cmd{\unsetjuncto} te gebruiken wordt \cmd{\lastconjunction} weer terug gezet naar `\texttt{ en }'. + Als eerder handmatig de koppelingen zijn veranderd, dan zijn die wijzigingen door één van deze macro's overschreven. + Gebruik dan in plaats van \cmd{\unsetjuncto} \cmd{\setlastconjunction}\marg{waarde}. +} +\clearpage + + +\section{\translation{Interdocument References}{Interdocumentaire Verwijzingen}}\label{sec:extern} +\translation{Referencing Other Documents Generated with the \package{regulatory} Package is Quite Simple.}{Verwijzen naar andere documenten gegenereerd met het \package{regulatory} pakket kan vrij eenvoudig.} +\DescribeMacro{\refdocument\\\oarg{prefix}\\\marg{name}\\\marg{opts...}} +\translation{% + After specifying \cmd{\refdocument} in the preamble, it is possible to refer to articles, paragraphs, and subparagraphs. + The macro family \cmd{\aref} continues to work seamlessly, thanks to \cmd{\zexternaldocument} from \package{zref-xr}. + To avoid ambiguity, a special \option{prefix} can be added. + If a \option{prefix} is omitted, a default \option{prefix} is still applied, namely \texttt{ext-}. + For instance, label \texttt{lid:lorem} becomes \texttt{ext-lid:lorem}. + Note that the \option{prefix} does not apply when referring to definitions with \cmd{\gls}.% +}{% + Na het opgeven van \cmd{\refdocument} in de preamble kan er naar artikelen, leden en onderdelen verwezen worden. + De macro familie \cmd{\aref} blijft dankzij \cmd{\zexternaldocument} van \package{zref-xr} nog steeds werken. + Om ambiguïteit te voorkomen kan er een speciale \option{prefix} toegevoegd worden. + Bij het weglaten van een \option{prefix} is er alsnog een \option{prefix}, namelijk \texttt{ext-}. + Label \texttt{lid:lorem} wordt dan \texttt{ext-lid:lorem}. + Let wel dat de \option{prefix} niet geldt voor het verwijzen naar definities met \cmd{\gls}.% +}\\ + +\noindent +\DescribeMacro{\masterdocument\\\oarg{prefix}\\\marg{name}\\\marg{opts...}\\} +\translation{% + To create a complete link with other \package{regulatory} documents, the \cmd{\masterdocument} macro is used. + A complete link involves:% +}{% + Om een volledige koppeling te maken met andere \package{regulatory} documenten wordt de \cmd{\masterdocument} macro gebruikt. + Een volledige koppeling houdt in:% +} +\begin{enumerate} + \item \translation{referring with the \cmd{\aref} family}{verwijzen met de \cmd{\aref} familie}; + \item \translation{referencing definitions with the \cmd{\gls} family}{verwijzen naar definities met de \cmd{\gls} familie}; + \item \translation{referring to the associated document}{verwijzen naar het bijbehorende document}; + \item \translation{a footnote with the document attached as an appendix to the first occurrence of a reference or definition}{een voetnoot met het document als bijlage bij de eerste verschijning van een verwijzing of definitie}. +\end{enumerate} +\translation{% + It's even possible for a document to have multiple 'master' documents, as is the case with this document (in Dutch):% +}{% + Het kan zelfs dat een document meerdere `master' documenten heeft, zoals dit document:% +} +\begin{lstlisting}[style=tex] +\newcommand\definitionlabel[1]{~(zie #1)} +\masterdocument[ex1-]{example1}{ + defs=example1, + author=E. Nijenhuis, + subject= Voorbeeld Één, + description = Het éérste voorbeeld document, + ref label=van Voorbeeld Één, + def label=\definitionlabel +} + +\masterdocument[ex2-]{example2}{ + defs=example2, + author=E. Nijenhuis, + subject= Voorbeeld Twee, + description = Het tweede voorbeeld document, + ref label=van Voorbeeld Twee, + def label=\definitionlabel +} +\end{lstlisting} + +\translation{% + Both macros \cmd{\refdocument} and \cmd{\masterdocument} have, as a third argument, a choice among the following options: +}{% + Beide macro's \cmd{\refdocument} en \cmd{\masterdocument} hebben als derde argument keuze uit de volgende opties:% +} +\begin{labeling}{\texttt{footnote label}} + \addtokomafont{labelinglabel}{\ttfamily} + \item[name] \translation{% + by default, the same as the first argument of the macros.% + }{% + standaard hetzelfde als het eerste argument van de macro's.% + } + \item[filename] \translation{% + by default, the first argument concatenated with \texttt{.pdf}. + This option can be overridden if the name does not correspond to the filename.% + }{% + standaard het eerste argument met \texttt{.pdf} geconcateneerd. + Deze optie kan overschreven worden wanneer de naam niet correspondeerd met de bestandsnaam.% + } + \item[ref label] \translation{% + by default, this macro has no value, and in that case, the following default value is used in \cmd{\documentlabel}:% + }{% + standaard heeft deze macro geen waarde en in dat geval wordt er in \cmd{\documentlabel} de volgende standaard waarde gebruikt:% + } \lstinline|\GetTranslation{of the} \artifactsubject{#1}|. + \translation{% + This macro receives the \texttt{name} of the document as an argument.% + }{% + Deze macro krijgt als argument de \texttt{name} van het document.% + } + \item[def label] \translation{% + by default, this macro has the following value:% + }{% + standaard heeft deze macro de volgende waarde:% + } \lstinline|~(\GetTranslation{see} #1)|. + \translation{% + The argument contains the \texttt{subject} with a possible footnote (depending on \texttt{referred}).% + }{% + Het argument bevat de \texttt{subject} met eventueel de footnote (afhankelijk van \texttt{referred}).% + } + \item[footnote] \translation{% + by default, the value is \texttt{true}, so that footnotes are added at the first occurrence. + This can be set to \texttt{false} to prevent this.% + }{% + standaard is de waarde \texttt{true}, zodat er voetnoten geplaatst worden bij de eerste verschijning. + Deze kan naar \texttt{false} gezet worden om dit te voorkomen.% + } + \item[footnote label] \translation{% + This macro receives the attached document with \texttt{subject} as its representation in the text. + By default, this macro only prints the first argument.% + }{% + deze macro krijgt als argument het bijgevoegde document met \texttt{subject} als weergave in de tekst. + Standaard print deze macro enkel het eerste argument.% + } + \item[url] \translation{% + this option is yet to be implemented. + The purpose of this option is to indicate the source of the document in the footnote.% + }{% + deze optie wordt is nog niet geïmplementeerd. + De bedoeling van deze optie is om in de voetnoot de vindplaats van het document te duiden.% + } + \item[referred] \translation{% + This option is for internal use. + \cmd{\documentfootnote} sets this value to \texttt{true}.% + }{% + deze optie is voor intern gebruik. + \cmd{\documentfootnote} zet deze waarde naar \texttt{true}.% + } + \item[defs] \translation{% + This option is used to load external definition lists under this document. + This way, the correct source can be mentioned for first occurrences of definitions.% + }{% + deze optie wordt gebruikt om externe definitielijsten in te laden onder dit document. + Op deze manier kan bij eerste verschijningen van definities de juiste bron vermeldt worden.% + } + \item[author] \translation{% + This option is used in \cmd{\documentattachment} for metadata purposes in some PDF viewing applications.% + }{% + deze optie wordt in \cmd{\documentattachment} gebruikt voor metadata t.b.v.\ sommige PDF-weergave applicaties.% + } + \item[subject] \translation{% + This option is used, like \texttt{author}, in the appendix.% + }{% + deze optie wordt net als \texttt{author} gebruikt in de bijlage.% + } + \item[description] \translation{% + This option is used, like \texttt{author}, in the appendix.% + }{% + deze optie wordt net als \texttt{author} gebruikt in de bijlage.% + } +\end{labeling} + +\noindent +\DescribeMacro{\documentlabel\\\marg{label}} +\DescribeMacro{\documentfootnote\\\oarg{link text}\\\marg{label}} +\DescribeMacro{\documentattachment\\\marg{label}\\\marg{link text}} +\translation{% + For both references to definitions and articles, etc., the source is mentioned, and at the first appearance, a footnote is placed with an appendix of the document. + Behind the scenes, \cmd{\documentlabel}\footnote{This macro uses the label of references and not definitions.}, \cmd{\documentfootnote}, and \cmd{\documentattachment} are invoked for articles, etc., and definitions.% +}{% + Voor zowel verwijzingen naar definities als artikelen e.d.\ wordt de bron vermeldt en wordt er bij de eerste verschijning een voetnoot geplaatst met een bijlage van het exemplaar. + Onder water worden \cmd{\documentlabel}\footnote{Deze macro gebruikt het label van verwijzingen en dus niet van definities.} \cmd{\documentfootnote} en \cmd{\documentattachment} aangeroepen voor artikelen e.d.\ en definities.% +}\\ + +\noindent +\translation{These macros can be called manually.}{Deze macro's kunnen ook handmatig uitgevoerd worden.} +\translation{For example,}{Neem b\ij{}voorbeeld} \lstinline[style=tex]|\documentfootnote{example2}| \translation{, which results in}{wat zou leiden tot}: +`\documentfootnote{example2-\translation{en}{nl}}'. + +\clearpage + + +\section{\translation{Language Support}{Taalondersteuning}} +\translation{% + Initially, this package only provided support for Dutch. + When English was implemented, certain macros were added to facilitate easy switching between languages. + The notation of references in English and Dutch differs to an extent that setting the language can be quite complex, but this may make it adjustable for other languages as well.% +}{% + In beginsel bood dit pakket alleen ondersteuning voor Nederlands. + Toen Engels geïmplementeerd werd zijn er bepaalde macro's bij gekomen, zodat er makkelijk geschakeld kan worden tussen talen. + De notatie van verwijzingen in het Engels en Nederlands verschilt dusdanig dat de instelling van een taal enigszins complex kan zijn. + Echter, dit maakt het mogelijk aanpasbaar voor andere talen.% +}\\ + +\noindent +\DescribeMacro{\rref@setup\\\marg{lang}\\\marg{article opts...}\\\marg{para opts...}\\\marg{sub opts...}} +\translation{% + The \cmd{\rref@setup} macro takes the \meta{language} as first argument. + The other three arguments accept multiple options, namely:% +}{% + De \cmd{\rref@setup} macro heeft als eerste argument \meta{de taal} die moet worden ingesteld. + De andere drie argumenten accepteren meerdere opties, namelijk:% +} +\begin{labeling}{\texttt{group conjunction}} + \addtokomafont{labelinglabel}{\ttfamily} + \item[name] + \translation{% + the designation in lower case. + For example `article', `art.', `par', et cetera. + Default for% + }{% + de benaming in kleine letters, b\ij{}voorbeeld `artikel', `art.', `onderdeel', enzovoort. + Standaard voor% + }\\\GetTranslation{article} \lstinline|\GetTranslation{article}|, \\\GetTranslation{paragraph} \lstinline|\GetTranslation{paragraph}| \GetTranslation{and} \\\GetTranslation{subparagraph} \lstinline|\GetTranslation{subparagraph}|.% + \item[Name] \translation{% + the designation starting with a capital letter. For example, 'Article'. Like \texttt{name}, this option defaults to using \cmd{\GetTranslation}, but with an initial capital letter.% + }{% + de benaming beginnend met een hoofdletter, b\ij{}voorbeeld `Artikel'. + Net als \texttt{name} gebruikt deze optie standaard \cmd{\GetTranslation}, maar dan met een hoofdletter.% + } + \item[ref format] \translation{% + a macro with one argument, namely the current number. + For example, for a member (or subparagraph in English), \cmd{\ordinalstringnum} is used for this. + In such cases, it is important to consider case sensitivity using \cmd{\@ifrrefcap}. + Example:% + }{% + een macro met één argument, namelijk het huidige nummer. + Voor bijvoorbeeld een lid (of subparagraph in het Engels) is hiervoor \cmd{\ordinalstringnum} gebruikt. + In zo'n geval is het belangrijk om rekening te houden met hoofdletter gevoeligheid d.m.v.\ \cmd{\@ifrrefcap}. + Voorbeeld:% + } \lstinline[style=tex]|\@ifrrefcap{\Ordinalstringnum{...}}{\ordinalstringnum{...}}|. + \item[label format] \translation{% + the order of the reference and the name. + This macro takes two arguments, namely the \texttt{name} and the result of \texttt{ref format}. + For example, for an article in Dutch, the order is \texttt{\{\#1 \#2\}}, for a paragraph in Dutch \texttt{\{\#2 \#1\}}, and for a paragraph/lid in English \texttt{\textbackslash@gobble\{\#1\}\#2}\footnote{\texttt{\textbackslash@gobble} processes the argument but does not print anything.}. + Note that you need to specify a macro. + In the first example, you would pass \cmd{\mylabelformat} as an option and define it as: + }{% + de volgorde van de verwijzing en de naam. + Deze macro krijgt twee argumenten mee, namelijk de \texttt{name} en het resultaat van \texttt{ref format}. + Voor bijvoorbeeld een artikel is de volgorde \texttt{\{\#1 \#2\}}, voor een lid \texttt{\{\#2 \#1\}}, en voor een paragraph/lid in het engels \texttt{\textbackslash@gobble\{\#1\}\#2}\footnote{\texttt{\textbackslash@gobble} verwerkt het argument maar print niks uit.}. + Let wel dat je een macro dient op te geven. + Bij het eerste voorbeeld zou je \cmd{\mylabelformat} als optie meegeven en zou gedefinieerd zijn als: + }\lstinline[style=tex]|\newcommand\mylabelformat[2]{#1 #2}|. + \item[group conjunction] \translation{% + This value indicates how it should be linked to the parent part. + For example (Dutch), in ``artikel\Vtextvisiblespace1\textcolor{red}{,\Vtextvisiblespace}eerste\Vtextvisiblespace lid,'' the \texttt{group conjunction} is set to \lstinline|{,~}| for the article.% + }{% + deze waarde geeft aan hoe het dient gekoppeld te worden aan het bovenliggende onderdeel. + Bijvoorbeeld, in ``artikel\Vtextvisiblespace1\textcolor{red}{,\Vtextvisiblespace}eerste\Vtextvisiblespace lid'' is de \texttt{group conjunction} bij de instelling van het artikel gelijk aan \lstinline|{,~}|.% + } + \item[group format] \translation{% + This option accepts a macro with one argument. + The first argument contains all subparts. + For example, in English, for a subparagraph/onderdeel, the article and paragraph/lid need to be surrounded by square brackets. + The value would then be for the subpart \texttt{{[}\#1{]}}. + }{% + deze optie accepteert een macro met één argument. + Het eerste argument bevat alle onderliggende onderdelen. + Bijvoorbeeld in het Engels dient bij een subparagraph/onderdeel het artikel en paragraph/lid omringd te worden met blokhaken. + De waarde is dan bij het onderdeel \texttt{{[}\#1{]}}. + } +\end{labeling} +\translation{% + These options can vary for each article, paragraph, and subparagraph. + + When defining a new language, it's important to know that the default values are based on the English configuration. + For example, consider the Dutch configuration, including all the used helper macros: +}{% + Deze opties kunnen verschillen per artikel, lid en onderdeel. + + Bij het definiëren van een nieuwe taal is het belangrijk om te weten dat de standaard waarden gebaseerd zijn op de Engelse configuratie. + Neem bijvoorbeeld de Nederlandse configuratie, inclusief alle gebruikte hulp macro's:% +} +\begin{lstlisting}[style=TeX,caption={\translation{Dutch configuration}{Nederlandse configuratie}},numbers=left] +\newcommand\rref@refformat@noop[1]{#1} +\newcommand\rref@refformat@parenthesis[1]{(#1)} +\newcommand\rref@refformat@ordinal[1]{% + \@ifrrefcap{% + \Ordinalstringnum{#1}% + }{% + \ordinalstringnum{#1}% + }% +} +\newcommand\rref@refformat@alpha[1]{% + \@ifrrefcap{% + \ABAlphnum{#1}% + }{% + \abalphnum{#1}% + }% +} +\newcommand\rref@label@prefix[2]{#1 #2} +\newcommand\rref@label@postfix[2]{#2 #1} +\newcommand\rref@label@refonly[2]{\@gobble{#1}#2} +\newcommand\rref@group@braced[1]{{[}#1{]~}} + +\rref@setup{dutch}{ + group conjunction={,~} +}{ + ref format=\rref@refformat@ordinal, + label format=\rref@label@postfix, + group conjunction={,~}, + group format=\rref@refformat@noop +}{ + ref format=\rref@refformat@alpha, + label format=\rref@label@prefix, + group conjunction={,~}, + group format=\rref@refformat@noop +} +\end{lstlisting} + +\clearpage +\section*{\translation{Examples}{Voorbeelden}}\label{sec:example} +\lstset{numbers=left,frame=single} +\lstinputlisting[style=tex,numbers=left,caption={example1.tex},label={code:example1}]{example1.tex} + +\lstinputlisting[style=tex,numbers=left,caption={example2.tex},label={code:example2}]{example2.tex}\clearpage + +\lstinputlisting[style=tex,numbers=left,caption={md-example.tex},label={code:md-example}]{md-example.tex}\clearpage + +\lstinputlisting[style=md,numbers=left,caption={example.md},label={code:example-md}]{example.md}\clearpage + +\lstinputlisting[style=bib,numbers=left,caption={example1.bib}]{example1.bib} + +\lstinputlisting[style=bib,numbers=left,caption={example2.bib}]{example2.bib} diff --git a/macros/latex/contrib/regulatory/tex/fc-dutch.def b/macros/latex/contrib/regulatory/tex/fc-dutch.def new file mode 100644 index 0000000000..e1e1432121 --- /dev/null +++ b/macros/latex/contrib/regulatory/tex/fc-dutch.def @@ -0,0 +1,424 @@ +%% fc-dutch.def +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\ProvidesFCLanguage{dutch}[2022/06/19] + +\newcommand{\@ordinalMdutch}[2]{\edef#2{\number#1\relax.}} +\global\let\@ordinalMdutch\@ordinalMdutch +\newcommand{\@ordinalFdutch}[2]{\edef#2{\number#1\relax.}} +\global\let\@ordinalFdutch\@ordinalFdutch +\newcommand{\@ordinalNdutch}[2]{\edef#2{\number#1\relax.}} +\global\let\@ordinalNdutch\@ordinalNdutch + +\newcommand*\@@unitstringdutch[1]{% + \ifcase#1% + nul% + \or één% + \or twee% + \or drie% + \or vier% + \or vijf% + \or zes% + \or zeven% + \or acht% + \or negen% + \fi +}% +\global\let\@@unitstringdutch\@@unitstringdutch + +\global\let\@@unitstringdutch\@@unitstringdutch +\newcommand*\@@tenstringdutch[1]{% + \ifcase#1% + \or tien% + \or twintig% + \or dertig% + \or veertig% + \or vijftig% + \or zestig% + \or zeventig% + \or tachtig% + \or negentig% + \or honderd% + \fi +}% +\global\let\@@tenstringdutch\@@tenstringdutch + +\providecommand*{\honderd}{honderd}% +\providecommand*{\duizend}{duizend}% +\global\let\honderd\honderd +\global\let\duizend\duizend + +\newcommand*\@@teenstringdutch[1]{% + \ifcase#1% + tien% + \or elf% + \or twaalf% + \or dertien% + \or veertien% + \or vijftien% + \or zestien% + \or zeventien% + \or achttien% + \or negentien% + \fi +}% +\global\let\@@teenstringdutch\@@teenstringdutch + +\newcommand*{\@numberstringMdutch}[2]{% + \let\@unitstring=\@@unitstringdutch + \let\@teenstring=\@@teenstringdutch + \let\@tenstring=\@@tenstringdutch + \@@numberstringdutch{#1}{#2}% +} +\global\let\@numberstringMdutch\@numberstringMdutch +\global\let\@numberstringFdutch=\@numberstringMdutch +\global\let\@numberstringNdutch=\@numberstringMdutch + +\newcommand*{\@NumberstringMdutch}[2]{% +\@numberstringMdutch{#1}{\@@num@str}% +\edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}} +\global\let\@NumberstringMdutch\@NumberstringMdutch +\global\let\@NumberstringFdutch=\@NumberstringMdutch +\global\let\@NumberstringNdutch=\@NumberstringMdutch + +\newcommand*{\@ordinalstringMdutch}[2]{% + \let\@unitthstring=\@@unitthstringMdutch + \let\@teenthstring=\@@teenthstringMdutch + \let\@tenthstring=\@@tenthstringMdutch + \let\@unitstring=\@@unitstringdutch + \let\@teenstring=\@@teenstringdutch + \let\@tenstring=\@@tenstringdutch + \def\@thousandth{duizendste}% + \def\@hundredth{honderdste}% + \@@ordinalstringdutch{#1}{#2}% +}% +\global\let\@ordinalstringMdutch\@ordinalstringMdutch + +\global\let\@ordinalstringMdutch\@ordinalstringMdutch +\newcommand*{\@ordinalstringFdutch}[2]{% + \let\@unitthstring=\@@unitthstringFdutch + \let\@teenthstring=\@@teenthstringFdutch + \let\@tenthstring=\@@tenthstringFdutch + \let\@unitstring=\@@unitstringdutch + \let\@teenstring=\@@teenstringdutch + \let\@tenstring=\@@tenstringdutch + \def\@thousandth{duizendste}% + \def\@hundredth{honderdste}% + \@@ordinalstringdutch{#1}{#2}% +}% +\global\let\@ordinalstringFdutch\@ordinalstringFdutch + +\newcommand*{\@ordinalstringNdutch}[2]{% + \let\@unitthstring=\@@unitthstringNdutch + \let\@teenthstring=\@@teenthstringNdutch + \let\@tenthstring=\@@tenthstringNdutch + \let\@unitstring=\@@unitstringdutch + \let\@teenstring=\@@teenstringdutch + \let\@tenstring=\@@tenstringdutch + \def\@thousandth{duizendste}% + \def\@hundredth{honderdste}% + \@@ordinalstringdutch{#1}{#2}% +}% +\global\let\@ordinalstringNdutch\@ordinalstringNdutch + +\newcommand*{\@OrdinalstringMdutch}[2]{% + \@ordinalstringMdutch{#1}{\@@num@str}% + \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}% +}% +\global\let\@OrdinalstringMdutch\@OrdinalstringMdutch +\newcommand*{\@OrdinalstringFdutch}[2]{% + \@ordinalstringFdutch{#1}{\@@num@str}% + \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}% +}% +\global\let\@OrdinalstringFdutch\@OrdinalstringFdutch +\newcommand*{\@OrdinalstringNdutch}[2]{% + \@ordinalstringNdutch{#1}{\@@num@str}% + \edef#2{\noexpand\MakeUppercase\expandonce\@@num@str}% +}% +\global\let\@OrdinalstringNdutch\@OrdinalstringNdutch + +\newcommand*\@@unitthstringMdutch[1]{% + \ifcase#1% + nulde% + \or eerste% + \or tweede% + \or derde% + \or vierde% + \or vijfde% + \or zesde% + \or zevende% + \or achtste% + \or negende% + \fi +}% +\global\let\@@unitthstringMdutch\@@unitthstringMdutch +\newcommand*\@@tenthstringMdutch[1]{% + \ifcase#1% + \or tiende% + \or twintigste% + \or dertigste% + \or veertigste% + \or vijftigste% + \or zestigste% + \or zeventigste% + \or tachtigste% + \or negentigste% + \fi +}% +\global\let\@@tenthstringMdutch\@@tenthstringMdutch +\newcommand*\@@teenthstringMdutch[1]{% + \ifcase#1% + tiende% + \or elfde% + \or twaalfde% + \or dertiende% + \or veertiende% + \or vijftiende% + \or zestiende% + \or zeventiende% + \or achttiende% + \or negentiende% + \fi +}% +\global\let\@@teenthstringMdutch\@@teenthstringMdutch +\newcommand*\@@unitthstringFdutch[1]{% + \ifcase#1% + nullte% + \or eerste% + \or tweede% + \or derde% + \or vierde% + \or vijfde% + \or zesde% + \or zevende% + \or achtste% + \or negende% + \fi +}% +\global\let\@@unitthstringFdutch\@@unitthstringFdutch +\newcommand*\@@tenthstringFdutch[1]{% + \ifcase#1% + \or tiende% + \or twintigste% + \or dertigste% + \or veertigste% + \or vijftigste% + \or zestigste% + \or zeventigste% + \or tachtigste% + \or negentigste% + \fi +}% +\global\let\@@tenthstringFdutch\@@tenthstringFdutch +\newcommand*\@@teenthstringFdutch[1]{% + \ifcase#1% + tiende% + \or elfde% + \or twaalfde% + \or dertiende% + \or veertiende% + \or vijftiende% + \or zestiende% + \or zeventiende% + \or achttiende% + \or zegentiende% + \fi +}% +\global\let\@@teenthstringFdutch\@@teenthstringFdutch +\newcommand*\@@unitthstringNdutch[1]{% + \ifcase#1% + nulde% + \or eerste% + \or tweede% + \or derde% + \or vierde% + \or vijfde% + \or zesde% + \or zevende% + \or achtste% + \or negende% + \fi +}% +\global\let\@@teenthstringNdutch\@@teenthstringNdutch +\newcommand*\@@numberunderhundreddutch[2]{% +\ifnum#1<10\relax + \ifnum#1>0\relax + \eappto#2{\@unitstring{#1}}% + \fi +\else + \@tmpstrctr=#1\relax + \@FCmodulo{\@tmpstrctr}{10}% + \ifnum#1<20\relax + \eappto#2{\@teenstring{\@tmpstrctr}}% + \else + \ifnum\@tmpstrctr=0\relax + \else + \eappto#2{\@unitstring{\@tmpstrctr}en}% + \fi + \@tmpstrctr=#1\relax + \divide\@tmpstrctr by 10\relax + \eappto#2{\@tenstring{\@tmpstrctr}}% + \fi +\fi +}% +\global\let\@@numberunderhundreddutch\@@numberunderhundreddutch +\newcommand*\@@numberstringdutch[2]{% +\ifnum#1>99999\relax + \PackageError{fmtcount}{Out of range}% + {This macro only works for values less than 100000}% +\else + \ifnum#1<0\relax + \PackageError{fmtcount}{Negative numbers not permitted}% + {This macro does not work for negative numbers, however + you can try typing "minus" first, and then pass the modulus of + this number}% + \fi +\fi +\def#2{}% +\@strctr=#1\relax \divide\@strctr by 1000\relax +\ifnum\@strctr>1\relax + \@@numberunderhundreddutch{\@strctr}{#2}% + \appto#2{duizend}% +\else + \ifnum\@strctr=1\relax + \eappto#2{\eintausend}% + \fi +\fi +\@strctr=#1\relax +\@FCmodulo{\@strctr}{1000}% +\divide\@strctr by 100\relax +\ifnum\@strctr>1\relax + \eappto#2{\@unitstring{\@strctr}honderd}% +\else + \ifnum\@strctr=1\relax + \ifnum#1>1000\relax + \appto#2{honderd}% + \else + \eappto#2{\honderd}% + \fi + \fi +\fi +\@strctr=#1\relax +\@FCmodulo{\@strctr}{100}% +\ifnum#1=0\relax + \def#2{null}% +\else + \ifnum\@strctr=1\relax + \appto#2{één}% + \else + \@@numberunderhundreddutch{\@strctr}{#2}% + \fi +\fi +}% +\global\let\@@numberstringdutch\@@numberstringdutch +\newcommand*\@@numberunderhundredthdutch[2]{% +\ifnum#1<10\relax + \eappto#2{\@unitthstring{#1}}% +\else + \@tmpstrctr=#1\relax + \@FCmodulo{\@tmpstrctr}{10}% + \ifnum#1<20\relax + \eappto#2{\@teenthstring{\@tmpstrctr}}% + \else + \ifnum\@tmpstrctr=0\relax + \else + \eappto#2{\@unitstring{\@tmpstrctr}-en-}% + \fi + \@tmpstrctr=#1\relax + \divide\@tmpstrctr by 10\relax + \eappto#2{\@tenthstring{\@tmpstrctr}}% + \fi +\fi +}% +\global\let\@@numberunderhundredthdutch\@@numberunderhundredthdutch +\newcommand*\@@ordinalstringdutch[2]{% +\@orgargctr=#1\relax +\ifnum\@orgargctr>99999\relax + \PackageError{fmtcount}{Out of range}% + {This macro only works for values less than 100000}% +\else + \ifnum\@orgargctr<0\relax + \PackageError{fmtcount}{Negative numbers not permitted}% + {This macro does not work for negative numbers, however + you can try typing "minus" first, and then pass the modulus of + this number}% + \fi +\fi +\def#2{}% +\@strctr=\@orgargctr\divide\@strctr by 1000\relax +\ifnum\@strctr>1\relax +\@@numberunderhundreddutch{\@strctr}{#2}% + \@tmpstrctr=\@orgargctr\@FCmodulo{\@tmpstrctr}{1000}% + \ifnum\@tmpstrctr=0\relax + \eappto#2{\@thousandth}% + \else + \appto#2{duizend}% + \fi +\else + \ifnum\@strctr=1\relax + \ifnum\@orgargctr=1000\relax + \eappto#2{\@thousandth}% + \else + \eappto#2{\duizend}% + \fi + \fi +\fi +\@strctr=\@orgargctr +\@FCmodulo{\@strctr}{1000}% +\divide\@strctr by 100\relax +\ifnum\@strctr>1\relax + \@tmpstrctr=\@orgargctr \@FCmodulo{\@tmpstrctr}{100}% + \ifnum\@tmpstrctr=0\relax + \ifnum\@strctr=1\relax + \eappto#2{\@hundredth}% + \else + \eappto#2{\@unitstring{\@strctr}\@hundredth}% + \fi + \else + \eappto#2{\@unitstring{\@strctr}honderd}% + \fi +\else + \ifnum\@strctr=1\relax + \@tmpstrctr=\@orgargctr \@FCmodulo{\@tmpstrctr}{100}% + \ifnum\@tmpstrctr=0\relax + \eappto#2{\@hundredth}% + \else + \ifnum\@orgargctr>1000\relax + \appto#2{honderd}% + \else + \eappto#2{\honderd}% + \fi + \fi + \fi +\fi +\@strctr=\@orgargctr +\@FCmodulo{\@strctr}{100}% +\ifthenelse{\@strctr=0 \and \@orgargctr>0 }{}{% +\@@numberunderhundredthdutch{\@strctr}{#2}% +}% +}% +\global\let\@@ordinalstringdutch\@@ordinalstringdutch +%\FCloadlang{dutchb}% +\iffalse Local variables: \fi +\iffalse mode: docTeX \fi +\iffalse End: \fi +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/regulatory/tex/regulatory.sty b/macros/latex/contrib/regulatory/tex/regulatory.sty new file mode 100644 index 0000000000..f6b3be5e88 --- /dev/null +++ b/macros/latex/contrib/regulatory/tex/regulatory.sty @@ -0,0 +1,699 @@ +%% regulatory.sty +%% Copyright 2024 E. Nijenhuis +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status ‘maintained’. +% +% The Current Maintainer of this work is E. Nijenhuis. +% +% This work consists of the files regulatory.tex, +% regulatory-preamble.tex, regulatory-nl.tex, regulatory-en.tex, +% example1.bib, example2.bib, +% example1-nl.tex, example2-nl.tex, +% example1-en.tex, example2-en.tex, +% md-example.tex, example.md, +% fc-dutch.def and regulatory.sty +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{regulatory}[2024/01/16 Xerdi's Regulatory Package] + +\RequirePackage{pgfopts} +\RequirePackage{xifthen} +\RequirePackage{keyval} +\RequirePackage{xstring} +\RequirePackage{xspace} + +\newif\ifregulatory@markdown +\newif\ifregulatory@bibtogls +\newif\ifregulatory@legacy +\newif\ifregulatory@alldefs +\pgfkeys{ + /regulatory/.is family, + /regulatory, + md/.is if=regulatory@markdown, + md=false, + bib2gls/.is if=regulatory@bibtogls, + bib2gls=true, + legacy/.is if=regulatory@legacy, + legacy=false, + alldefs/.is if=regulatory@alldefs, + alldefs=false +} + +\InputIfFileExists{regulatory.cfg}{% + \PackageInfo{regulatory}{Using local configuration file}% +}{% + \PackageInfo{regulatory}{No local configuration file}% +} + +\newboolean{regulatory@nameinlink} +\setboolean{regulatory@nameinlink}{true} + +\ProcessPgfPackageOptions{/regulatory} + +% Markdown support +\ifregulatory@markdown +\RequirePackage[hashEnumerators,definitionLists,hybrid,headerAttributes=true]{markdown} +\setkeys{markdownRenderers}{ +headingOne={\article{#1}}, +olItemWithNumber={\item{}}, +olBeginTight={\begin{paras}}, +olEndTight={\end{paras}}, +olBegin={\begin{paras}}, +olEnd={\end{paras}}, +dlBeginTight={\begin{labeling}{\@glswidestname}}, +dlEndTight={\end{labeling}}, +dlBegin={\begin{labeling}{\@glswidestname}}, +dlEnd={\end{labeling}}% +\renewcommand\markdownRendererOlItemWithNumber[1]{\item{}\label{ml:##1}} +} +\fi + +% Pakketten ná markdown (anders gaat enumitem kapot) +\RequirePackage{xcolor} +\RequirePackage{xassoccnt} +\RequirePackage{xpatch} +\RequirePackage{titlesec} +\RequirePackage{enumitem} +\RequirePackage{fmtcount} +\RequirePackage{scrextend} +\RequirePackage{xr-hyper} +\RequirePackage[user,counter,hyperref,xr]{zref} +\RequirePackage{zref-xr,zref-user,zref-clever,zref-hyperref} +\RequirePackage{hyperref} +\RequirePackage{pgf} +\RequirePackage[sanitize=none,nopostdot]{glossaries} +\ifregulatory@bibtogls +\RequirePackage[record,style=alttree]{glossaries-extra} +\else +\PackageWarning{regulatory}{Using glossaries for definitions without bib2gls. This is mostly untested.} +\fi + +\RequirePackage{attachfile2} +\RequirePackage{translations} + +\newboolean{regulatory@defslisted} +\setboolean{regulatory@defslisted}{false} + +% Kleuren +\providecolor{artlabel}{rgb}{0,0,0} +\providecolor{arttitle}{rgb}{0,0,0} +\providecolor{paralabel}{rgb}{0,0,0} +\providecolor{paratitle}{rgb}{0,0,0} +\providecolor{sublabel}{rgb}{0,0,0} +\providecolor{subtitle}{rgb}{0,0,0} + + + +% Artikelen +\newcounter{article} +\titleclass{\article}[0]{straight} +\titleformat{\article}{\normalfont\color{arttitle}}{\bfseries\color{artlabel}Artikel \thearticle.\quad}{1em}{} +\titlespacing*{\article}{0pt}{3.5ex plus 1ex minus .2ex}{5pt} + +\newcounter{para} +\titleclass{\para}{straight}[\article] +\titleformat{\para}{\normalfont\color{paratitle}}{\normalfont\color{paralabel}\thearticle.\thepara.\quad}{1em}{} +\titlespacing*{\para}{0pt}{3.5ex plus 1ex minus .2ex}{5pt} +\counterwithin{para}{article} + +\renewcommand{\thearticle}{\arabic{article}} +\renewcommand{\thepara}{\arabic{para}} +\makeatletter +\newcommand{\l@article}{\@dottedtocline{1}{1.5em}{2.3em}} +\def\toclevel@article{2} +\newcommand{\l@para}{\@dottedtocline{1}{3.8em}{2.3em}} +\def\toclevel@para{3} + +\newcounter{provisions} +\newlist{provisions}{enumerate}{1} +\setlist[provisions,1]{label=\arabic*.,align=left,itemsep=0pt} +\counterwithin{provisions}{section} + +\newlist{paras}{enumerate}{2} +\setlist[paras,1]{label=\thearticle.\arabic*.,ref=\arabic*,align=left,itemsep=0pt} +\setlist[paras,2]{label=\abalphnum{\arabic*}),ref=\arabic*,itemsep=0pt} +\counterwithin{parasi}{article} +\counterwithin{parasii}{parasi} + +\zref@newprop{article}[-1]{\number\value{article}} +\zref@newprop{para}[-1]{\ifnum\value{para}>0\number\value{para}\else\number\value{parasi}\fi} +\zref@newprop{sub}[-1]{\number\value{parasii}} +\zref@addprops{main}{article,para,sub} + +\DeclareTranslation{dutch}{article}{artikel} +\DeclareTranslation{dutch}{paragraph}{lid} +\DeclareTranslation{dutch}{subparagraph}{onderdeel} +\DeclareTranslation{dutch}{Article}{Artikel} +\DeclareTranslation{dutch}{Paragraph}{Lid} +\DeclareTranslation{dutch}{Subparagraph}{Onderdeel} +\DeclareTranslation{dutch}{to}{tot} +\DeclareTranslation{dutch}{Definitions}{Definities} +\DeclareTranslation{dutch}{of the}{van de} + +\zcRefTypeSetup{article}{% + Name-sg = \GetTranslation{Article}, + name-sg = \GetTranslation{article}, + Name-pl = Artikelen, + name-pl = artikelen +} +\zcRefTypeSetup{para}{% + Name-sg = \GetTranslation{Paragraph}, + name-sg = \GetTranslation{paragraph}, + Name-pl = Leden, + name-pl = leden +} +\zcRefTypeSetup{parasi}{% + Name-sg = \GetTranslation{Paragraph}, + name-sg = \GetTranslation{paragraph}, + Name-pl = Leden, + name-pl = leden +} +\zcRefTypeSetup{parasii}{% + Name-sg = \GetTranslation{Subparagraph}, + name-sg = \GetTranslation{subparagraph}, + Name-pl = Onderdelen, + name-pl = onderdelen +} + +\makeatother +{\catcode`\#=12 \gdef\hashchar{#}} +\makeatletter +\def\rref@linkpr{\href{\rref@current@fullurl}} + +\newboolean{rref@cap} +\def\@ifrrefcap#1#2{% + \ifthenelse{\boolean{rref@cap}}{% + #1% + \ifthenelse{\equal{#1}{}}{}{% + \setboolean{rref@cap}{false}% + }% + }{% + #2% + }% +} +\def\@ifnameinlink#1#2{% + \ifthenelse{\boolean{regulatory@nameinlink}}{#1}{#2}% +} + +\newcommand\rref@middleconjunction{, } +\newcommand\rref@lastconjunction{ \GetTranslation{and} } +\newcommand\rref@rangeconjunction{ \GetTranslation{to} } + +\newcommand\setmiddleconjunction[1]{\renewcommand\rref@middleconjunction{#1}} +\newcommand\setlastconjunction[1]{\renewcommand\rref@lastconjunction{#1}} +\newcommand\setrangeconjunction[1]{\renewcommand\rref@rangeconjunction{#1}} + +\newcommand\setconjunction[3]{% + \setmiddleconjunction{#1}% + \setlastconjunction{#1}% + \setrangeconjunction{#1}% +} + +\newcommand\setjuncto{% +\setlastconjunction{ jo.\ }% +} + +\newcommand\unsetjuncto{% +\setlastconjunction{ \GetTranslation{and} }% +} + +\ifregulatory@legacy +\setjuncto +\fi + +\newcommand\rref@refformat@noop[1]{#1} +\newcommand\rref@refformat@parenthesis[1]{(#1)} +\newcommand\rref@refformat@ordinal[1]{\@ifrrefcap{\Ordinalstringnum{#1}}{\ordinalstringnum{#1}}} +\newcommand\rref@refformat@alpha[1]{\@ifrrefcap{\ABAlphnum{#1}}{\abalphnum{#1}}} +\newcommand\rref@label@prefix[2]{#1 #2} +\newcommand\rref@label@postfix[2]{#2 #1} +\newcommand\rref@label@refonly[2]{\@gobble{#1}#2} +\newcommand\rref@group@braced[1]{{[}#1{]~}} + +\newcommand\rref@init@lang@article[1]{% + \pgfkeys{/rref/#1/article/.is family, + /rref/#1/article, + name/.initial=\GetTranslation{article}, + Name/.initial=\GetTranslation{Article}, + ref format/.initial=\rref@refformat@noop, + label format/.initial=\rref@label@prefix, + group conjunction/.initial={}, + group format/.initial=\rref@refformat@noop + } +} +\newcommand\rref@init@lang@para[1]{% + \pgfkeys{/rref/#1/para/.is family, + /rref/#1/para, + name/.initial=\GetTranslation{paragraph}, + Name/.initial=\GetTranslation{Paragraph}, + ref format/.initial=\rref@refformat@parenthesis, + label format/.initial=\rref@label@refonly, + group conjunction/.initial={,}, + group format/.initial=\rref@refformat@noop + } +} +\newcommand\rref@init@lang@sub[1]{% + \pgfkeys{/rref/#1/sub/.is family, + /rref/#1/sub, + name/.initial=\GetTranslation{subparagraph}, + Name/.initial=\GetTranslation{Subparagraph}, + ref format/.initial=\rref@refformat@ordinal, + label format/.initial=\rref@label@postfix, + group conjunction/.initial={,}, + group format/.initial=\rref@group@braced + } +} + +\newcommand\rref@setup@lang[3]{% + \pgfkeys{/rref/#1/#2,#3} +} + +\newcommand\rref@setup[4]{% + \rref@init@lang@article{#1} + \rref@init@lang@para{#1} + \rref@init@lang@sub{#1} + \rref@setup@lang{#1}{article}{#2} + \rref@setup@lang{#1}{para}{#3} + \rref@setup@lang{#1}{sub}{#4} +} + +% The defaults are already based on English, so no arguments are given. +\rref@setup{english}{}{}{} + +\rref@setup{dutch}{ + group conjunction={,~} +}{ + ref format=\rref@refformat@ordinal, + label format=\rref@label@postfix, + group conjunction={,~}, + group format=\rref@refformat@noop +}{ + ref format=\rref@refformat@alpha, + label format=\rref@label@prefix, + group conjunction={,~}, + group format=\rref@refformat@noop +}% + +\newcommand\rref@set[4][\languagename]{% + \pgfkeysgetvalue{/rref/#1/#2/#3}{#4}% +} + +\newcommand\rref@get[3][\languagename]{% + \pgfkeysvalueof{/rref/#1/#2/#3}% +} + +\newcommand\rref@name[2][\languagename]{\@ifrrefcap{\rref@get[#1]{#2}{Name}}{\rref@get[#1]{#2}{name}}} +\def\rref@article@name{\rref@name{article}} +\def\rref@para@name{\rref@name{para}} +\def\rref@sub@name{\rref@name{sub}} + +\newcommand\rref@refformat[2][\rref@current@type]{\rref@set{#1}{ref format}{\@@rrefformat}\@@rrefformat{#2}} +\newcommand\rref@labelformat[2][\rref@current@type]{\rref@set{#1}{label format}{\@@labelformat}\@@labelformat{\rref@name{#1}}{#2}} +\newcommand\rref@linkformat[2][\rref@current@type]{% + \@ifnameinlink{% + \rref@linkpr{\rref@labelformat[#1]{\rref@refformat[#1]{#2}}}% + }{% + \rref@labelformat[#1]{\rref@linkpr{\rref@refformat[#1]{#2}}}% + }% +} +\newcommand\rref@reflink[2][\rref@current@type]{% + \rref@linkpr{\rref@refformat[#1]{#2}}% +} +\newcommand\rref@groupformat[2][\rref@current@type]{% + \rref@set{#1}{group format}{\@@groupformat}\@@groupformat{#2}% +} + +\def\rref{\@ifstar\rref@star\rref@nostar} +\def\rref@star#1{% + \rref@setcurrent{#1}% + \ifnum\rref@current@value>0% + \rref@refformat{\rref@current@value}% + \else% + \zref{#1}% + \fi% +} +\def\rref@nostar#1{% + \rref@setcurrent{#1}% + \ifnum\rref@current@value>0% + \rref@linkpr{\rref@refformat{\rref@current@value}}% + \else% + \zcref[noname]{#1}% + \fi% +} +\def\Rref{\@ifstar\Rref@star\Rref@nostar} +\def\Rref@star#1{% + \setboolean{rref@cap}{true}% + \rref*{#1}% +} +\def\Rref@nostar#1{% + \setboolean{rref@cap}{true}% + \rref{#1}% +} + +\def\nref{\@ifstar\nref@star\nref@nostar} +\def\nref@star#1{% + \rref@setcurrent{#1}% + \ifnum\rref@current@value>0% + \rref@labelformat{\rref@refformat{\rref@current@value}}% + \else% + \zcref*{#1}% + \fi% +} +\def\nref@nostar#1{% + \rref@setcurrent{#1}% + \ifnum\rref@current@value>0% + \rref@linkformat{\rref@current@value}% + \else% + \zcref{#1}% + \fi% +} +\def\Nref{\@ifstar\Nref@star\Nref@nostar} +\def\Nref@star#1{% + \setboolean{rref@cap}{true}% + \nref*{#1}% +} +\def\Nref@nostar#1{% + \setboolean{rref@cap}{true}% + \nref{#1}% +} + +\def\rref@setcurrent#1{% + \def\rref@current{#1}% + \def\rref@current@counter{\zref@extract{#1}{counter}}% + \def\rref@current@article{\zref@extract{#1}{article}}% + \def\rref@current@para{\zref@extract{#1}{para}}% + \def\rref@current@sub{\zref@extract{#1}{sub}}% + \rref@settype% + \rref@setlink% +} +\def\rref@settype{% + \ifthenelse{\equal{article}{\rref@current@counter}}{% + \def\rref@current@type{article}% + \def\rref@current@value{\rref@current@article}% + \def\rref@current@fullformat{}% + }{% + \ifthenelse{\equal{para}{\rref@current@counter}\or\equal{parasi}{\rref@current@counter}}{% + \def\rref@current@type{para}% + \def\rref@current@value{\rref@current@para}% + }{% + \ifthenelse{\equal{parasii}{\rref@current@counter}}{% + \def\rref@current@type{sub}% + \def\rref@current@value{\rref@current@sub}% + }{% + \def\rref@current@type{}% + \def\rref@current@value{-1}% + }% + }% + }% +} +\def\rref@setlink{% + \def\rref@current@anchor{\zref@extract{\rref@current}{anchor}}% + \def\rref@current@url{\zref@extractdefault{\rref@current}{url}{}}% + \def\rref@current@fullurl{\rref@current@url\hashchar\rref@current@anchor}% +} +\newcommand\rref@number[1]{% + \zref@extractdefault{#1}{\rref@current@type}{-1}% +} + +\newcommand\aref@setcurrent[1]{% + \def\aref@current@reflink{\rref@reflink[\rref@current@type]{\rref@current@value}}% + \zref@ifrefcontainsprop{#1}{externaldocument}{% + \filename@parse{\expanded{\zref@extract{#1}{externaldocument}}}% + \edef\@aref@filelabel{\expanded{\filename@base}}% + \def\@aref@postlink{% + , \documentlabel{\@aref@filelabel}% + \ifthenelse{\equal{\artifactfootnote{\@aref@filelabel}}{true}\and\equal{\artifactreferred{\@aref@filelabel}}{false}}{% + \documentfootnote{\@aref@filelabel}% + }{}% + }% + }{% + \def\@aref@postlink{}% + }% + \ifthenelse{\equal{\rref@current@type}{article}}{% + \def\@aref@prefix{}% + \def\@aref@postfix{}% + }{% + \ifthenelse{\equal{\rref@current@type}{para}}{% + \def\@aref@prefix{% + \rref@labelformat[article]{\rref@current@article}\rref@get{article}{group conjunction}% + }% + \def\@aref@postfix{}% + }{% + \ifthenelse{\equal{\rref@current@type}{sub}}{% + \def\@aref@prefix{% + \rref@labelformat[article]{\rref@refformat[article]{\rref@current@article}}\rref@get{article}{group conjunction}% + \rref@labelformat[para]{\rref@refformat[para]{\rref@current@para}}\rref@get{para}{group conjunction}% + }% + \def\@aref@postfix{}% + }{% + \def\@aref@prefix{}% + \def\@aref@postfix{}% + }% + }% + }% +} + +\newcommand{\aref}[1]{% + \def\@@arefsetup##1##2{% + \rref@setcurrent{##1}% + \aref@setcurrent{##1}% + \rref@groupformat{\@aref@prefix}% + ##2% + \@aref@postfix\@aref@postlink% + }% + \IfSubStr{#1}{,}{% + \StrBefore[1]{#1}{,}[\firstarg]% + \@@arefsetup{\firstarg}{\rref@labelformat{\aref@group{#1}}}% + }{% + \@@arefsetup{#1}{\nref{#1}}% + }% +} + +\newcommand{\Aref}[1]{% + \setboolean{rref@cap}{true}% + \aref{#1}% +} + +\def\listterminator{-1} + +\newcommand\aref@group[1]{% + \bubblesort{#1}% + \expandafter\begincompaction\sortedlist,\listterminator,\relax% +} +\def\begincompaction#1,#2\relax{% + \def\startlist{#1}% + \def\currentendlist{#1}% + \findendlist#2\relax% +} +\def\findendlist#1,#2\relax{% + \ifnum\numexpr\rref@number{\currentendlist}+1\relax=\rref@number{#1}\relax% + \def\currentendlist{#1}% + \findendlist#2\relax% + \else% + \ifnum\rref@number{\startlist}=\rref@number{\currentendlist}\relax% + \ignorespaces\rref{\startlist}\unskip% + \else% + \ifnum\numexpr\rref@number{\startlist}+1\relax=\rref@number{\currentendlist}\relax% + \ignorespaces\rref{\startlist}\unskip% + \ifnum\rref@number{#1}=\listterminator\relax% + \rref@lastconjunction% + \else% + \rref@middleconjunction% + \fi\ignorespaces% + \rref{\currentendlist}\unskip% + \else% + \ignorespaces\rref{\startlist}\unskip\rref@rangeconjunction\ignorespaces% + \rref{\currentendlist}\unskip% + \fi% + \fi% + \ifnum\rref@number{#1}=\listterminator\else% + \IfStrEq{#2}{\listterminator,}{\rref@lastconjunction}{\rref@middleconjunction}\begincompaction#1,#2\relax% + \fi% + \fi% +} +\newcommand\bubblesort[1]{\def\sortedlist{}\sortlist#1,\listterminator,\relax} +\def\sortlist#1,#2,#3\relax{% + \rref@setcurrent{#1}% + \aref@setcurrent{#1}% + \ifnum\rref@number{#2}=\listterminator\relax% + \edef\sortedlist{\sortedlist#1}% + \else% + \ifnum\rref@number{#1}<\rref@number{#2}\relax% + \edef\sortedlist{\sortedlist#1,}% + \sortlist#2,#3\relax% + \else% + \let\tmp\sortedlist% + \def\sortedlist{}% + \expandafter\sortlist\tmp#2,#1,#3\relax% + \fi% + \fi% +} + +\GetAllResetLists +\RegisterPostLabelHook{\zlabel} + +\newglossary*{definitions}{Definitions} +\newglossary*{externals}{Externals} + +\newcommand\artifact@footnote@noop[1]{#1} +\newcommand\artifact@def@label@default[1]{~(\GetTranslation{see} #1)} + +\newcommand\newartifact[2]{% + \pgfkeys{ + /artifact/#1/.is family, + /artifact/#1, + name/.initial = #1, + filename/.initial = #1.pdf, + path/.initial = ./, + ref label/.initial=, + def label/.initial=\artifact@def@label@default, + footnote/.initial = true, + footnote label/.initial=\artifact@footnote@noop, + url/.initial=, + referred/.initial = false, + defs/.initial=, + author/.initial=<author>, + subject/.initial=<subject>, + description/.initial=<description> + } + \pgfkeys{/artifact/#1,#2} +} +\newcommand\@aget[2]{\pgfkeysvalueof{/artifact/#1/#2}} +\newcommand\artifact@setfootnotelabel[1]{\pgfkeysgetvalue{/artifact/#1/footnote label}{\artifactfootnotelabel}} +\newcommand\artifactname[1]{\@aget{#1}{name}} +\newcommand\artifactfullname[1]{\@aget{#1}{path}\@aget{#1}{name}} +\newcommand\artifactfilename[1]{\@aget{#1}{filename}} +\newcommand\artifactfullfilename[1]{\@aget{#1}{path}\@aget{#1}{filename}} +\newcommand\artifactfootnote[1]{\@aget{#1}{footnote}} +\newcommand\artifacturl[1]{\@aget{#1}{url}} +\newcommand\artifactreferred[1]{\@aget{#1}{referred}} +\newcommand\artifactdefs[1]{\@aget{#1}{defs}} +\newcommand\artifactauthor[1]{\@aget{#1}{author}} +\newcommand\artifactsubject[1]{\@aget{#1}{subject}} +\newcommand\artifactdescription[1]{\@aget{#1}{description}} + +\renewcommand{\glossarysection}[2][]{\@gobble{#1}\@gobble{#2}}% +\setglossarypreamble[definitions]{% + \ifnum\value{article}=0% + \article{\GetTranslation{Definitions}}\label{art:definitions}% + \vspace*{-\baselineskip}% + \else% + \ifnum\value{parasi}=0% + \vspace*{-\baselineskip}% + \fi% + \fi% +} + +\newcommand\describe[1]{\setboolean{regulatory@defslisted}{true}\glstarget{#1}{\glsentrydesc{#1}}} +\newcommand\printdefs[1]{% + \renewcommand*{\glsnamefont}[1]{\textmd{##1}}% + \setboolean{regulatory@defslisted}{true}% + \glssetwidest{#1}% + \ifnum\value{parasi}>0% + \def\@@wrapper##1{\begin{minipage}{\linewidth}##1\end{minipage}}% + \else% + \def\@@wrapper##1{##1}% + \fi% + \@@wrapper{% + \ifregulatory@bibtogls% + \printunsrtglossary[type=definitions,style=alttree,title={},nonumberlist=true]% + \else% + \printglossary[type=definitions,style=alttree,title={},nonumberlist=true]% + \fi% + }% +} + +\attachfilesetup{color=black} + +\newcommand\documentattachment[2]{% + \def\@tmpfile{\artifactfullfilename{#1}}% + \IfFileExists{\@tmpfile}{% + \textattachfile[description={\artifactdescription{#1}},subject={\artifactsubject{#1}},author={\artifactauthor{#1}}]{\@tmpfile}{#2}}% + {\texttt{#2}}% +} + +\newcommand\documentlabel[1]{% + \def\@@label{\@aget{#1}{ref label}}% + \ifthenelse{\equal{\@@label}{}}{% + \GetTranslation{of the} \artifactsubject{#1}% + }{\@@label}% +} + +\newcommand\documentfootnote[2][]{% + \pgfkeysifdefined{/artifact/#2/referred}{% + \pgfkeys{/artifact/#2,referred=true}% + \artifact@setfootnotelabel{#2}% + \ifthenelse{\equal{#1}{}}{% + \def\artifact@description{\artifactsubject{#2}}% + }{% + \def\artifact@description{#1}% + }% + \footnote{\artifactfootnotelabel{\documentattachment{#2}{\artifact@description}}}% + }{\PackageWarning{regulatory}{Artifact does not exists '#2'}\footnote{DOCUMENT NOT FOUND '#2'}} +} + +\edef\@regulatory@bib@selection{} +\ifregulatory@alldefs +\edef\@regulatory@bib@selection{,selection=all} +\fi + +\newcommand\loadglsdefs[1]{% + \setboolean{regulatory@defslisted}{true}% + \ifregulatory@bibtogls% + \GlsXtrLoadResources[type=definitions,src={#1},sort={nl-NL},category={defs}\@regulatory@bib@selection]% + \else% + \loadglsentries[definitions]{#1}% + \fi% +} + +\newcommand\loadextdefs[2][externals]{% + \ifregulatory@bibtogls% + \GlsXtrLoadResources[type=externals,src={#2},sort={nl-NL},category={#1}]% + \else%}{% + \loadglsentries[externals]{#2}% + \fi%}% + \glsdefpostlink{#1}{% + \ifthenelse{\equal{\artifactreferred{#1}}{true}}{}{% + \@aget{#1}{def label}{% + \artifactsubject{#1}% + \documentfootnote{#1}% + }% + }% + }% +} + +\newcommand\refdocument[3][ext-]{% + \newartifact{#2}{footnote=false,#3}% + \zexternaldocument[#1]{\artifactfullname{#2}}[#2]% +} + +\newcommand\masterdocument[3][ext-]{% + \newartifact{#2}{#3}% + \zexternaldocument[#1]{\artifactfullname{#2}}[#2]% + \ifthenelse{\equal{\string\artifactdefs{#2}}{}}{% + \PackageWarning{regulatory}{No definitions given to the master document. \the\gls commands will therefore not work.}% + }{% + \PackageWarning{regulatory}{Agreement file loads #1, #2, #3.} + \loadextdefs[#2]{\artifactdefs{#2}}% + \ifregulatory@bibtogls% + \glssetcategoryattribute{#2}{targeturl}{\artifactfilename{#2}}% + \glssetcategoryattribute{#2}{targetname}{\glolinkprefix\glslabel}% + \fi% + }% +} + +\AtEndPreamble{% +\ifregulatory@bibtogls\else% +\ifthenelse{\boolean{regulatory@defslisted}}{\makeglossaries}{}% +\fi% +} +\AtEndDocument{% +\ifregulatory@alldefs\glsaddallunused\fi% +} diff --git a/macros/latex/contrib/robust-externalize/robust-externalize.pdf b/macros/latex/contrib/robust-externalize/robust-externalize.pdf Binary files differindex cb3a4071e7..58ea1ff714 100644 --- a/macros/latex/contrib/robust-externalize/robust-externalize.pdf +++ b/macros/latex/contrib/robust-externalize/robust-externalize.pdf diff --git a/macros/latex/contrib/robust-externalize/robust-externalize.sty b/macros/latex/contrib/robust-externalize/robust-externalize.sty index 3bf14a9f95..0a36647946 100644 --- a/macros/latex/contrib/robust-externalize/robust-externalize.sty +++ b/macros/latex/contrib/robust-externalize/robust-externalize.sty @@ -1,4 +1,4 @@ -\ProvidesPackage{robust-externalize}[2.2 Cache anything (tikz, latex, python) in a robust, efficient and pure way.] +\ProvidesPackage{robust-externalize}[2.5 Cache anything (tikz, latex, python) in a robust, efficient and pure way.] % todo: % change order argument replace from list, it is hard to read this way @@ -11,7 +11,7 @@ \RequirePackage{iftex} % computing md5 sum differs on lualatex/pdflatex/xelatex \RequirePackage{xparse} % solve https://github.com/leo-colisson/robust-externalize/issues/6 \RequirePackage{atveryend} % to compile in parallel all images -\usepackage{etl} % For auto forward https://tex.stackexchange.com/a/700844/116348 +%\usepackage{etl} % For auto forward https://tex.stackexchange.com/a/700844/116348 %% TODO list: % - provide an easy way to use cross-ref, bibtex etc (we just need to add them when writing the file) without recompiling the whole document (we don't want to lose the cache everytime a new bib entry is added) but while preserving. @@ -20,14 +20,127 @@ %%%%%%%%%%% Utils %%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% If the file contains a space, the jobname gets quotes around... +% https://tex.stackexchange.com/questions/418670/avoid-quotation-marks-when-using-jobname-or-currfilename +\newcommand*{\jobnameNoQuotes}{} +\newcommand*{\setjobnameNoQuotes}{% + \edef\jobnameNoQuotes{\jobname}% + \expandafter\expandafter\expandafter\setjobnameNoQuotesaux + \expandafter\jobnameNoQuotes\expandafter"\jobnameNoQuotes"\relax +} +\newcommand*{\setjobnameNoQuotesaux}{} +\def\setjobnameNoQuotesaux#1"#2"#3\relax{\def\jobnameNoQuotes{#2}} +\setjobnameNoQuotes + \ExplSyntaxOn \NewDocumentCommand{\robExtIfWindowsTF}{mm}{% \sys_if_platform_windows:TF {#1}{#2}% } + +% This will be printed in from of the error message, mostly useful in texstudio that only print lines +% containing errors +\def\robExtPrefixLogMessage{} + +% Prints the next 4 lines after an error: +\def\robExtLinesAfterError{3} +\def\robExtRemoveLineNumber{} + +%% Needed for studio to prepend ! in front of all lines, including big ones. +%% https://tex.stackexchange.com/questions/705502/message-add-symbol-in-front-of-new-lines-even-if-there-is-a-line-break +\def\robExtMessageWithPrefixNumberLines{^^J}% +\cs_new:Nn \robExt__message_with_prefix:n { + \str_set:Nn \l_tmpa_str {#1} + \int_compare:nNnTF {\str_count:N \l_tmpa_str + \str_count:N \robExtPrefixLogMessage} > {78} { + \typeout{\robExtPrefixLogMessage \str_range:Nnn \l_tmpa_str {1} {78 - \str_count:N \robExtPrefixLogMessage}\robExtMessageWithPrefixNumberLines} + \robExt__message_with_prefix:x {\str_range:Nnn \l_tmpa_str {78 - \str_count:N \robExtPrefixLogMessage + 1} {-1}} + }{ + \typeout{\robExtPrefixLogMessage \l_tmpa_str \robExtMessageWithPrefixNumberLines} + } +} +\cs_generate_variant:Nn \robExt__message_with_prefix:n { x } + +% We might want to remove l.XX in front of lines as emacs interpret this as a line of error and goes to a wrong place. +\cs_new:Nn \robExt__clean_line_if_needed:n { + \ifdefined\robExtRemoveLineNumber% + \str_compare:eNeTF {\str_range:nnn {#1} {1} {2}} = {l.} { + \str_range:nnn {#1} {3} {-1}% + } { + #1 + } + \else + #1 + \fi +} +\cs_generate_variant:Nn \robExt__clean_line_if_needed:n { V } + +\cs_new:Nn \robExt_get_errors_from_file:n { + \ior_open:Nn \g__robExt_read_ior {#1}% + \cs_undefine:N \l__robExt_I_saw_an_error: + \str_clear_new:N \l__robExt_tmp_str% + \int_set:Nn \l_tmpa_int {0} + \ior_str_map_inline:Nn \g__robExt_read_ior {% + \ifdefined\robExtPrintWholeFile + \str_gput_right:Nx \l__robExt_tmp_str {\tl_to_str:n{##1}^^J}% + \cs_set:Nn \l__robExt_I_saw_an_error: {} + \int_set:Nn \l_tmpa_int {\robExtLinesAfterError} + \else + \str_if_in:xnTF {\str_lowercase:n{##1}} {error} { + \str_gput_right:Nx \l__robExt_tmp_str {\robExt__clean_line_if_needed:V{\tl_to_str:n{##1}^^J}}% + \cs_set:Nn \l__robExt_I_saw_an_error: {} + \int_set:Nn \l_tmpa_int {\robExtLinesAfterError} + } { + \str_if_in:xnTF {\str_lowercase:n{##1}} {invalid} { + \str_gput_right:Nx \l__robExt_tmp_str {\robExt__clean_line_if_needed:V{\tl_to_str:n{##1}^^J}}% + \cs_set:Nn \l__robExt_I_saw_an_error: {} + \int_set:Nn \l_tmpa_int {\robExtLinesAfterError} + } { + % Check if it starts with a ! (usually latex errors start with this symbol) + \str_compare:eNeTF {\str_range:nnn {##1} {1} {1}} = {!} { + \str_gput_right:Nx \l__robExt_tmp_str {\robExt__clean_line_if_needed:V{\tl_to_str:n{##1}^^J}}% + \cs_set:Nn \l__robExt_I_saw_an_error: {} + \int_set:Nn \l_tmpa_int {\robExtLinesAfterError} + }{ + % Check if we saw an error not too long ago: + \int_compare:nNnTF {\l_tmpa_int} > {0} { + \str_gput_right:Nx \l__robExt_tmp_str {\robExt__clean_line_if_needed:V{\tl_to_str:n{##1}^^J}}% + } { + \str_set:Nn \l_tmp_str {##1} + } + \int_set:Nn \l_tmpa_int {\l_tmpa_int - 1} + } + } + } + \fi + }% + \cs_if_exist:NTF \l__robExt_I_saw_an_error: {} { + % We print the last line if we found no error. Might be useful for errors like: + % sh: ligne 1: gnuplot : commande introuvable. + \str_set_eq:NN \l__robExt_tmp_str \l_tmp_str + } +} + +\cs_new:Nn \robExt_write_file_in_log:n { + \ior_open:Nn \g__robExt_read_ior {#1}% + \ior_str_map_inline:Nn \g__robExt_read_ior {% + \ifdefined\robExtPrintWholeFile + \ifdefempty{\robExtPrefixLogMessage}{ + \typeout{\tl_to_str:n{##1}}% + }{ + \robExt__message_with_prefix:x {\tl_to_str:n{##1}} + } + \else + \typeout{\tl_to_str:n{##1}}% + \fi + }% +} + +\cs_generate_variant:Nn \robExt_write_file_in_log:n { x } + \ExplSyntaxOff % Debug function: by default, do nothing \def\robExtDebugMessage#1{} +\def\robExtDebugInfo#1{\message{#1}} \def\robExtDebugWarning#1{\message{^^J[robExt warning] #1}} \NewDocumentCommand{\robExtConfigure}{m}{% @@ -53,6 +166,7 @@ \cs_generate_variant:Nn \str_replace_all:Nnn { Nnx, Nnv, cnx, cxx, NnV, Nnx, Nnv } \cs_generate_variant:Nn \str_set:Nn { NV } +\cs_generate_variant:Nn \str_if_in:nnTF { xnTF } \cs_generate_variant:Nn \tl_rescan:nn { nv } \cs_generate_variant:Nn \tl_set_rescan:Nnn { Nnv, NnV } @@ -65,6 +179,7 @@ \cs_generate_variant:Nn \ior_str_get:NN { Nc } \cs_generate_variant:Nn \file_if_exist:nTF { xTF } +\cs_generate_variant:Nn \file_mdfive_hash:n { x } \cs_generate_variant:Nn \cs_replacement_spec:N { c } \cs_generate_variant:Nn \cs_argument_spec:N { c } @@ -110,25 +225,33 @@ %% In LaTeX3 error messages are defined here, this allows people to translate them, filter them, change them, %% make them more verbose etc. \msg_new:nnn {robExt}{underscore in name}{Error:~all~the~placeholders~should~contain~two~consecutive~underscores~in~their~name.} -\msg_new:nnn {robExt}{placeholder not existing}{[robExtGetPlaceholderInResultFromSinglePlaceholder] ~ The ~ placeholder ~ #3 ~ does ~ not ~ exists.} +\msg_new:nnn {robExt}{placeholder not existing}{[robExtGetPlaceholderInResultFromSinglePlaceholder] ~ The ~ placeholder ~ #1 ~ does ~ not ~ exists.} \msg_new:nnn {robExt}{forgot template}{You ~ are ~ writing ~ __ROBEXT_TEMPLATE__ ~ to ~ your ~ file: ~ seems ~ like ~ you ~ forgot ~ to ~ define ~ your ~ template ~ or ~ set ~ a ~ preset} \msg_new:nnn {robExt}{need shell escape}{You ~ need ~ to ~ compile ~ with ~ shell-escape ~ as ~ in: ~ "pdflatex ~ -shell-escape ~ yourfile.tex" ~ to ~ be ~ able ~ to ~ compile ~ automatically ~ the ~ figures} +\msg_new:nnn {robExt}{need shell escape with}{You ~ need ~ to ~ compile ~ with ~ shell-escape ~ as ~ in: ~ "pdflatex ~ -shell-escape ~ yourfile.tex" ~ to ~ be ~ able ~ to ~ #1} \msg_new:nnn {robExt}{need shell escape parallel}{You ~ need ~ to ~ compile ~ with ~ shell-escape ~ as ~ in: ~ "pdflatex ~ -shell-escape ~ yourfile.tex" ~ to ~ be ~ able ~ to ~ compile ~ automatically ~ the ~ figures ~ in ~ parallel} -\msg_new:nnn {robExt}{missing compiled pdf}{The ~ pdf ~ file ~ #1.pdf ~ is ~ not ~ present. ~ The ~ compilation ~ command ~ certainly ~ failed, ~ see ~ logs ~ above ~ or ~ in ~ #1.log.} -\msg_new:nnn {robExt}{missing compiled pdf parallel}{The ~ pdf ~ file ~ #1.pdf ~ is ~ not ~ present. ~ The ~ compilation ~ command ~ "#3"~used~to~compile~the~environment~on~line~#2~ certainly ~ failed, ~ see ~ logs ~ above ~ or ~ in ~ #1.log.} +\msg_new:nnn {robExt}{missing compiled pdf parallel}{The~compilation~of~block~at~line~#2~failed~as~the~following ~ file~is~missing: ~ #1.pdf. ~ The ~ compilation ~ command ~ "#3"~used~to~compile~the~environment~on~line~#2~ certainly ~ failed, ~ see ~ logs ~ above ~ or ~ in ~ #1.log.} +\msg_new:nnn {robExt}{dependency does not exist}{The~dependency~#1~does~not~exist.} + +\msg_new:nnn {robExt}{missing compiled pdf parallel with log}{The~compilation~of~the~code~block~at~line~#2~failed:~the~following ~ file~is~indeed~missing: ~ #1.pdf. ~ The ~ compilation ~ command ~ "#3"~used~to~compile~the~environment~on~line~#2~ certainly ~ failed~with~errors:^^Jvvvvvv^^J\l__robExt_tmp_str^^J\string^\string^\string^\string^\string^\string^ ^^JSee~full~logs~#4~ or ~ in ~ #1-compilation.log.} + + \msg_new:nnn {robExt}{auto forward not in cachemecode}{Auto~forward~is~less~efficient~in~cacheMeCode.} +\msg_new:nnn {robExt}{file does not exist}{The~file~#1~does~not~exist.} + % warnings \msg_new:nnn {robExt}{recommend two underscores in placeholders}{We~recommend~to~use~only~placeholders~containing~two~consecutive~underscores~in~their~name} \msg_new:nnn {robExt}{enabled parallel no shell escape}{Warning:~you~enabled~parallel~compilation~but~shell-escape~is~disabled.} \msg_new:nnn {robExt}{rerun because parallel}{Warning:~Compiling~all~missing~figures~in~parallel~with~"#1".~You~need~to~rerun~LaTeX~to~include~them.} +\msg_new:nnn {robExt}{gpgetvar recompilation needed}{Warning:~you~need~to~recompile~as~the~gpgetvar~variable~"#1"~does~not~exist~yet.} % dummy placeholders added if image is not present \def\robExtImagePlaceholderIfManualMode{ \framebox[\linewidth] { \begin{minipage}{\linewidth} - \textbf{Manual ~ mode: ~ either ~ compile ~ with ~ \texttt{-shell-escape} ~ or ~ compile:\newline \texttt{\robExtAddCachePathAndName{\robExtFinalHash.tex}}\newline via ~ \newline \texttt{\l__robExt_current_compilation_command_str}\newline or ~ call ~ \newline\texttt{bash ~ \jobname-\robExtAddPrefixName{compile-missing-figures.sh}}\newline to ~ compile ~ all ~ missing ~ figures.} + \textbf{Manual ~ mode: ~ either ~ compile ~ with ~ \texttt{-shell-escape} ~ or ~ compile:\newline \texttt{\robExtAddCachePathAndName{\robExtFinalHash.tex}}\newline via ~ \newline \texttt{\l__robExt_current_compilation_command_str}\newline or ~ call ~ \newline\texttt{bash ~ \jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}}\newline to ~ compile ~ all ~ missing ~ figures.} \end{minipage} } } @@ -137,7 +260,7 @@ \framebox[\linewidth] { \begin{minipage}{\linewidth} - \textbf{Falling ~ back ~ to ~ draft ~ mode: ~ either ~ compile ~ with ~ \texttt{-shell-escape} ~ or ~ compile:\newline \texttt{\robExtAddCachePathAndName{\robExtFinalHash.tex}}\newline via ~ \newline \texttt{\l__robExt_current_compilation_command_str}\newline or ~ call ~ \newline\texttt{bash ~ \jobname-\robExtAddPrefixName{compile-missing-figures.sh}}\newline to ~ compile ~ all ~ missing ~ figures.} + \textbf{Falling ~ back ~ to ~ draft ~ mode: ~ either ~ compile ~ with ~ \texttt{-shell-escape} ~ or ~ compile:\newline \texttt{\robExtAddCachePathAndName{\robExtFinalHash.tex}}\newline via ~ \newline \texttt{\l__robExt_current_compilation_command_str}\newline or ~ call ~ \newline\texttt{bash ~ \jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}}\newline to ~ compile ~ all ~ missing ~ figures.} \end{minipage} } } @@ -163,9 +286,10 @@ %%% Important: this script is NOT executed by this file, it is only created so that users can remove unused previously cached files by running this script %%% outside of LaTeX. %%% Create scripts to remove useless files: -%%% Note that we don't override the script if it exists on purpose (the user might have changed it to fits their needs) -\begin{filecontents}[noheader]{robExt-remove-old-figures.py} +\begin{filecontents}[noheader,overwrite]{robExt-remove-old-figures.py} #!/usr/bin/env python3 +## This file is automatically generated, so do not change that file directly +## Instead, if you need to change it, copy it with a different name and edit the copy import os import re import glob @@ -214,6 +338,63 @@ if __name__ == '__main__': main() \end{filecontents} +\begin{filecontents}[noheader,overwrite]{robExt-prepare-for-arxiv.py} +#!/usr/bin/env python3 +## This file is automatically generated, so do not change that file directly +## Instead, if you need to change it, copy it with a different name and edit the copy + +## This file must be called when sending stuff to the arxiv website, that would otherwise remove the .pdf +## in presence of a .tex. +## This script will simply rename the .tex files in robustExternalize into .tex-backup. +## Then, you should call "rename backup files for arxiv" to rename back the files. +import os +import re +import glob +# Just run this script in order to remove all old figures not listed in robExt-all-figures.txt. + +# Note that this part is not extracted from the pdf file since it might be different on a previous run. You can however hardcode +# it here, your updated script will not be overriden unless you remove it yourself. +prefixes = [ "robExt-" ] +folders = [ "robustExternalize" ] + +def main(): + listOfFilesToMove = [] + listOfFilesAlreadyAdded = set() + for folder in folders: + for root, dirs, files in os.walk(folder): + for f in files: + if f.endswith(".tex"): + pdf = os.path.splitext(f)[0] + ".pdf" + if os.path.exists(os.path.join(root,pdf)): + listOfFilesToMove.append((os.path.join(root,f), os.path.join(root,f + "-backup"))) + if f.endswith(".tex-backup"): + tex = os.path.splitext(f)[0] + ".tex" + listOfFilesAlreadyAdded.add(os.path.join(root,tex)) + for (f,f2) in listOfFilesToMove: + print(f"-- {f} moved to {f2}") + listOfFilesAlreadyAdded.discard(f) + for f in listOfFilesAlreadyAdded: + print(f"-- {f} already moved") + print(f"Above are the files to move or already moved, are you sure you want to proceed? [y/N] (based on prefixes {prefixes})") + x = input().strip() + if x not in ["y", "Y"]: + print("All right, we abort.") + exit(1) + for (f,f2) in listOfFilesToMove: + os.replace(f, f2) + print(f"Moved {f} to {f2}") + with open('robExt-arxiv-files-to-rename.txt', 'w') as fd: + for (f,f2) in listOfFilesToMove: + fd.write(f'{f}\n') + for f in listOfFilesAlreadyAdded: + fd.write(f'{f}\n') + print('The files have been written to robExt-arxiv-files-to-rename.txt.') + print('Add \\robExtConfigure{rename backup files for arxiv} in your tex file.') + +if __name__ == '__main__': + main() +\end{filecontents} + \ExplSyntaxOn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -258,6 +439,9 @@ if __name__ == '__main__': %%%%%%%%%%% Paths %%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% For support of --output-directory +\def\robExtPrefixAllCompilationCommands{\ifdefined\robExtOutputDirectory cd~"\robExtOutputDirectory"~&&~\fi} + \def\robExtPrefixFilename{robExt-} \NewExpandableDocumentCommand{\robExtAddCachePathAndName}{m}{% @@ -272,6 +456,48 @@ if __name__ == '__main__': \fi#1% } +% mv in unix and move in windows: +\robExtIfWindowsTF{ + \def\robExtMv{move} + \def\robExtCp{copy} +}{ + \def\robExtMv{mv} + \def\robExtCp{cp} +} + +\NewDocumentCommand{\robExtBackupSource}{m}{% + % arXiv will remove the .pdf file if the .tex is present. Solution: we move the .tex into .tex-backup + % and restore it during compilation. We could also backup the pdf but usually this file is bigger and will contain + % binary data that might not be so easy to copy in pure tex (in arxiv shell escape is disabled so we cannot + % use cp). + % \show\inBackupSource + \robExtRunCmdIfPossible{% + \robExtMv\space"\robExtAddCachePath{#1}"~% + "\robExtAddCachePath{#1-backup}"% + }% +} + +\NewDocumentCommand{\robExtRunCmdIfPossible}{m}{% + % Check if the output directory exists + \bool_if:nTF { \sys_if_shell_unrestricted_p: || \cs_if_exist_p:N \robExtForceCompilation} + { + \ifdefined\robExtManualMode + \message{Warning:~running~in~manual~mode~so~we~cannot~run~the~command~``#1''.} + \iow_now:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {#1} + \else + \message{Running:~\robExtPrefixAllCompilationCommands #1}% + \sys_shell_now:x {\robExtPrefixAllCompilationCommands #1} + \fi + }{ + \ifdefined\robExtFallbackManualMode + \message{Warning:~shell~escape~fallback~to~manual~mode~so~cannot~run~#1.} + \iow_now:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {#1} + \else + \msg_error:nnx{robExt}{need shell escape with}{run~#1} + \fi + } +} + \NewDocumentCommand{\robExtCheckIfPrefixFolderExists}{}{ % Check if the output directory exists \ifdefined\robExtCacheFolder @@ -279,17 +505,74 @@ if __name__ == '__main__': { \ifdefined\robExtDoNotMkdirFolder\else \ifdefined\robExtManualMode - \message{If ~ you ~ get~ an~ error,~ make ~ sure ~ to ~ enable ~ pdflatex ~ -shell-escape ~ or ~ to ~ manually ~ create ~ the ~ folder ~ \robExtCacheFolder.} + \message{If ~ you ~ get~ an~ error,~ make ~ sure ~ to ~ enable ~ pdflatex ~ -shell-escape ~ or ~ to ~ MANUALLY ~ CREATE ~ THE ~ FOLDER ~ \robExtCacheFolder.} \else - \sys_shell_now:x {mkdir ~ -p ~ \robExtCacheFolder} + \sys_shell_now:x {\robExtPrefixAllCompilationCommands mkdir ~ -p ~ \robExtCacheFolder} \fi \fi }{ - \message{If ~ you ~ get~ an~ error,~ make ~ sure ~ to ~ enable ~ pdflatex ~ -shell-escape ~ or ~ to ~ manually ~ CREATE ~ THE ~ FOLDER ~ \robExtCacheFolder.} + \message{Warning: If ~ you ~ get~ an~ error,~ make ~ sure ~ to ~ enable ~ pdflatex ~ -shell-escape ~ or ~ to ~ manually ~ CREATE ~ THE ~ FOLDER ~ \robExtCacheFolder.} } \fi } +\NewDocumentCommand{\robExtCopyFileToCache}{m}{ + \robExtCheckIfPrefixFolderExists% + \file_if_exist:xTF {#1}{}{ + \msg_error:nnx{robExt}{file does not exist}{#1~(to~copy~to~cache)} + } + \file_if_exist:xTF {\robExtAddCachePath{#1}}{ + \robExtDebugInfo{The~file~\robExtAddCachePath{#1}~already~exists,~let~us~compare~md5~sum.} + \str_set:Nx \l_tmpa_str {\file_mdfive_hash:n{#1}} + \str_set:Nx \l_tmpb_str {\file_mdfive_hash:n{\robExtAddCachePath{#1}}} + \str_compare:eNeTF {\l_tmpa_str} = {\l_tmpb_str} { + \robExtDebugInfo{The~file~\robExtAddCachePath{#1}~has~the~good~md5~hash.} + }{ + \robExtDebugInfo{The~md5~hashes~of~#1~and~\robExtAddCachePath{#1}~are~different(\l_tmpa_str \space vs \space \l_tmpb_str),~let~us~copy~the~file.}% + \robExtRunCmdIfPossible{\robExtCp \space "#1"~"\robExtAddCachePath{#1}"}% + } + }{ + \robExtDebugInfo{The~file~\robExtAddCachePath{#1}~does~not~exist,~let~us~copy~it:} + \robExtRunCmdIfPossible{\robExtCp \space "#1"~"\robExtAddCachePath{#1}"}% + } +} +\let\copyFileToCache\robExtCopyFileToCache + +% \robExtRenameBackupFilesForArxiv{robExt-arxiv-files-to-rename.txt} takes all elements listed in the .tex file +% (like robustExternalize/robExt-F83AB245D8043E653A89489C2E25AA6A.tex) and rename the +% robustExternalize/robExt-F83AB245D8043E653A89489C2E25AA6A.tex-backup into +% robustExternalize/robExt-F83AB245D8043E653A89489C2E25AA6A.tex +% (needed for arxiv) +% This is done, importantly, without shell escape as arxiv does not have shell escape. +\NewDocumentCommand{\robExtRenameBackupFilesForArxiv}{O{-backup}m}{ + \file_if_exist:xTF{#2} { + \robExtDebugInfo{We~will~read~the~file~#2.} + \ior_open:Nn \g__robExt_read_ior {#2}% + %% We avoid creating a new ior since the number of available files is limited in tex + \seq_clear:N \l_tmpa_seq + \ior_str_map_inline:Nn \g__robExt_read_ior {% + \file_if_exist:xTF{##1#1} { + \seq_put_right:Nn \l_tmpa_seq {##1} + }{ + \robExtDebugInfo{Warning:~##1#1~does~not~exist,~so~we~will~not~rename~back~this~file~for~arXiv.} + } + }% + \ior_close:N \g__robExt_read_ior + \seq_map_inline:Nn \l_tmpa_seq { + \robExtDebugInfo{We~copy~the~source~##1#1~to~##1^^J}% + % First we read the file: + \ior_open:Nn \g__robExt_read_ior {##1#1}% + \iow_open:Nx \g__robExt_write_iow {##1} + \ior_str_map_inline:Nn \g__robExt_read_ior {% + \iow_now:Nx \g__robExt_write_iow {\tl_to_str:n{####1}}% + }% + \iow_close:N \g__robExt_write_iow + \ior_close:N \g__robExt_read_ior + } + }{ + \robExtDebugInfo{Warning:~#2~does~not~exist,~so~we~will~not~rename~back~elements~for~arXiv.} + } +} \NewExpandableDocumentCommand{\robExtGetPrefixPath}{}{% \ifdefined\robExtCacheFolder% @@ -317,9 +600,9 @@ if __name__ == '__main__': %% TODO: create a makefile. \iow_new:N \g__robExt_write_list_all_figures_iow %% Create a file robExt-all-figures.txt with the list of .tex files -\iow_open:Nx \g__robExt_write_list_all_figures_iow {\jobname-\robExtAddPrefixName{all-figures.txt}} +\iow_open:Nx \g__robExt_write_list_all_figures_iow {\jobnameNoQuotes-\robExtAddPrefixName{all-figures.txt}} \iow_new:N \g__robExt_write_manually_compile_all_missing_figures_iow -\iow_open:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {\jobname-\robExtAddPrefixName{compile-missing-figures.sh}} +\iow_open:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {\jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}} % Contains the list of dependency files (useful to compute the final md5sum) \seq_new:N \l__robExt_dependencies_str @@ -450,7 +733,7 @@ if __name__ == '__main__': } \let\evalPlaceholderNoReplacement\robExtEvalPlaceholderNoReplacement -\NewDocumentCommand{\robExtGetPlaceholderNoReplacement}{m}{ +\NewExpandableDocumentCommand{\robExtGetPlaceholderNoReplacement}{m}{ \str_use:c { l__robExt_placeholder_#1_str } } \let\getPlaceholderNoReplacement\robExtGetPlaceholderNoReplacement @@ -545,7 +828,7 @@ if __name__ == '__main__': %% Warning: only LaTeX-friendly code should be placed here, as LaTeX does not preserve some symbols and adds spaces %% Tested! %% The star version does NOT import the placeholder (useful for efficiency reasons) -\NewDocumentCommand{\robExtPlaceholderFromContent}{smm}{ +\NewDocumentCommand{\robExtPlaceholderFromContent}{sm+m}{ \robExt_set_hash_robust:cn { l__robExt_placeholder_#2_str } {#3} \checkIfPlaceholderNameIsLegal{#2} \ifdefined\robExtCompletelyDisableWholeImportSystem\else% Mostly for time optimizations... @@ -662,10 +945,10 @@ if __name__ == '__main__': %% https://tex.stackexchange.com/a/680259/116348 might work and be more efficient, but it might be less reliable %% and definitely more complicated and error prone. Instead, we write to a file and read the result. %% TODO: try to do it using verbatim, might be trivial or complicated, not sure, maybe see https://tex.stackexchange.com/questions/555359/reading-lines-verbatim-into-a-sequence-variable - \XSIMfilewritestart{\jobname-robExt-tmp-file-you-can-remove.tmp}% + \XSIMfilewritestart{\jobnameNoQuotes-robExt-tmp-file-you-can-remove.tmp}% }{% \XSIMfilewritestop% - \ior_open:Nn \g__robExt_read_ior {\jobname-robExt-tmp-file-you-can-remove.tmp}% + \ior_open:Nn \g__robExt_read_ior {\jobnameNoQuotes-robExt-tmp-file-you-can-remove.tmp}% %% Put the file in l__robExt_tmp_contain_file_str \str_clear_new:N \l__robExt_tmp_str% \ior_str_map_inline:Nn \g__robExt_read_ior {% @@ -762,10 +1045,10 @@ if __name__ == '__main__': %% This will copy "some code" in the cache, and set MYLIBPATH to the name of the file in the cache like %% MYLIBPATH = robExt-abc.py \NewDocumentEnvironment{RobExtPlaceholderPathFromCode}{sO{}m}{ - \XSIMfilewritestart*{\jobname-robExt-tmp-file-you-can-remove.tmp} + \XSIMfilewritestart*{\jobnameNoQuotes-robExt-tmp-file-you-can-remove.tmp} }{ \XSIMfilewritestop - \ior_open:Nn \g__robExt_read_ior {\jobname-robExt-tmp-file-you-can-remove.tmp} + \ior_open:Nn \g__robExt_read_ior {\jobnameNoQuotes-robExt-tmp-file-you-can-remove.tmp} %% Put the file in \l__robExt_tmp_contain_file_str \str_clear_new:N \l__robExt_tmp_contain_file_str \ior_str_map_inline:Nn \g__robExt_read_ior { @@ -856,7 +1139,7 @@ if __name__ == '__main__': \cs_if_exist:cTF { l__robExt_placeholder_#3_str }{ \str_set_eq:Nc { \l_robExt_result_str }{ l__robExt_placeholder_#3_str } }{ - \msg_error:nn{robExt}{placeholder not existing} + \msg_error:nnx{robExt}{placeholder not existing}{#3} } \robExtDebugMessage{Starting~to~replace~placeholder~#3~to~get~\l_robExt_result_str} \__robExt_replace_until_impossible: @@ -1039,7 +1322,7 @@ if __name__ == '__main__': % First we remove existing occurrences (useful to avoid listing the same macro more than once % if we redefine a macro): \seq_map_inline:Nn \l__robExt_tmp_seq { - \message{Adding ##1 to #1} + \robExtDebugMessage{Adding ##1 to #1} \seq_remove_all:cn {l__robExt_placeholder_group_#1_seq} {##1} \seq_put_right:cn {l__robExt_placeholder_group_#1_seq} {##1} } @@ -1126,6 +1409,7 @@ if __name__ == '__main__': \seq_new:N \l__robExt_list_groups_seq % contains the list of all groups +%%%% \robExtRegisterGroupPlaceholders{bash} adds "bash" to the list of existing groups \NewDocumentCommand{\robExtRegisterGroupPlaceholders}{m}{ \seq_if_exist:cTF {l__robExt_placeholder_group_#1_seq}{}{ \seq_clear_new:c {l__robExt_placeholder_group_#1_seq} @@ -1187,7 +1471,11 @@ if __name__ == '__main__': } \NewDocumentCommand{\robExtAddDependency}{m}{ - \seq_put_left:Nx \l__robExt_dependencies_str {#1} + \file_if_exist:nTF {#1} { + \seq_put_left:Nx \l__robExt_dependencies_str {#1} + } { + \msg_error:nnx{robExt}{dependency does not exist}{#1} + } } \NewDocumentCommand{\robExtDebugDependency}{}{ @@ -1356,7 +1644,12 @@ if __name__ == '__main__': % not want to recompile when the file changes \robExtUseHookJustBeforeWritingFiles% %% We add the figure in the list of files. - \iow_now:Nx \g__robExt_write_list_all_figures_iow {\robExtAddPrefixName{\robExtFinalHash.tex}} + % Avoid writing the same command multiple times (might occur in environments that execute the + % same command multiple times like align etc) + \cs_if_exist:cTF {l__robExt_write_list_all_figures_\robExtAddPrefixName{\robExtFinalHash.tex}:}{}{ + \iow_now:Nx \g__robExt_write_list_all_figures_iow {\robExtAddPrefixName{\robExtFinalHash.tex}} + \cs_gset:cn {l__robExt_write_list_all_figures_\robExtAddPrefixName{\robExtFinalHash.tex}:} {} + } %% We can now set the placeholders, and recompute the final value of the file: %% I was doing before \robExtPlaceholderFromContent + \robExtEvalPlaceholderInplace, but it is too slow \str_set:Nx \l_tmp_output_prefix_str {\robExtAddPrefixName{\robExtFinalHash}} @@ -1367,21 +1660,45 @@ if __name__ == '__main__': \str_replace_all:Nnx \l_robExt_result_str {__ROBEXT_WAY_BACK__}{\robExtCacheFolderWayBack} \str_replace_all:Nnx \l_robExt_result_str {__ROBEXT_CACHE_FOLDER__}{\robExtCacheFolder} \file_if_exist:xTF{\robExtAddCachePathAndName{\robExtFinalHash.tex}}{ - \message{The\space file\space \robExtAddCachePathAndName{\robExtFinalHash.tex} \space already\space exists.^^J} + \robExtDebugInfo{The\space file\space \robExtAddCachePathAndName{\robExtFinalHash.tex} \space already\space exists.^^J} }{ - \str_if_eq:VnTF { \l_robExt_result_str }{__ROBEXT_TEMPLATE__} { - \msg_error:nn{robExt}{forgot template} + % arXiv removes the .pdf if the .tex is present... so we need to manually remove the .tex file. + \file_if_exist:xTF{\robExtAddCachePathAndName{\robExtFinalHash.pdf}}{ + \robExtDebugInfo{The\space file\space \robExtAddCachePathAndName{\robExtFinalHash.pdf} \space already\space exists.^^J} + % Sometimes we still want to refer to the original tex file, for instance to input the source. + % So if a file .tex-backup exists, we copy it back to .tex: + \file_if_exist:xTF{\robExtAddCachePathAndName{\robExtFinalHash.tex-backup}} { + \robExtDebugInfo{We~copy~the~source~\robExtFinalHash.tex-backup~to~\robExtFinalHash.tex^^J}% + % First we read the file: + \ior_open:Nn \g__robExt_read_ior {\robExtAddCachePathAndName{\robExtFinalHash.tex-backup}}% + \iow_open:Nx \g__robExt_write_iow {\robExtAddCachePathAndName{\robExtFinalHash.tex}} + \ior_str_map_inline:Nn \g__robExt_read_ior {% + \iow_now:Nx \g__robExt_write_iow {\tl_to_str:n{##1}}% + }% + \iow_close:N \g__robExt_write_iow + \ior_close:N \g__robExt_read_ior + }{} }{ - % Check if the output directory exists - \robExtCheckIfPrefixFolderExists - \iow_open:Nx \g__robExt_write_iow {\robExtAddCachePathAndName{\robExtFinalHash.deps}} - \iow_now:NV \g__robExt_write_iow \l__robExt_dependencies_mdfive_str - \iow_close:N \g__robExt_write_iow - %% Save the final file: - \iow_open:Nx \g__robExt_write_iow {\robExtAddCachePathAndName{\robExtFinalHash.tex}} - \iow_now:NV \g__robExt_write_iow \l_robExt_result_str - \iow_close:N \g__robExt_write_iow - \message{Source ~ saved ~ in ~ \robExtAddCachePathAndName{\robExtFinalHash.tex}.} + \str_if_eq:VnTF { \l_robExt_result_str }{__ROBEXT_TEMPLATE__} { + \msg_error:nn{robExt}{forgot template} + }{ + % Check if the output directory exists + \robExtCheckIfPrefixFolderExists + \iow_open:Nx \g__robExt_write_iow {\robExtAddCachePathAndName{\robExtFinalHash.deps}} + \iow_now:NV \g__robExt_write_iow \l__robExt_dependencies_mdfive_str + \iow_close:N \g__robExt_write_iow + %% Save the final file: + \iow_open:Nx \g__robExt_write_iow {\robExtAddCachePathAndName{\robExtFinalHash.tex}} + \iow_now:NV \g__robExt_write_iow \l_robExt_result_str + \iow_close:N \g__robExt_write_iow + \robExtDebugInfo{Source ~ saved ~ in ~ \robExtAddCachePathAndName{\robExtFinalHash.tex}.} + \ifdefined\robExtPrintSourceWhenSaving + \typeout{Content~of~the~deps~file~\robExtAddCachePathAndName{\robExtFinalHash.deps}:^^J} + \robExt_write_file_in_log:x {\robExtAddCachePathAndName{\robExtFinalHash.deps}} + \typeout{Content~of~the~source~file~\robExtAddCachePathAndName{\robExtFinalHash.tex}:^^J} + \robExt_write_file_in_log:x {\robExtAddCachePathAndName{\robExtFinalHash.tex}} + \fi + } } } } @@ -1401,7 +1718,7 @@ if __name__ == '__main__': \let\l__robExt_do_not_compile\undefined } \cs_if_exist:NTF {\l__robExt_do_not_compile}{ - \message{No ~ need ~ to ~ recompile ~ \robExtAddCachePathAndName{\robExtFinalHash.pdf}^^J} + \robExtDebugInfo{No ~ need ~ to ~ recompile ~ \robExtAddCachePathAndName{\robExtFinalHash.pdf}^^J} }{ % Used to know later if we have run a compilation command at that step or not \cs_undefine:N \l__robExt_I_just_ran_a_compilation_command: @@ -1429,25 +1746,37 @@ if __name__ == '__main__': } {} \fi \ifdefined\robExtManualMode - \message{[robExt] Manual mode enabled: please, manually compile the images using \l__robExt_current_compilation_command_str or run 'bash \jobname-\robExtAddPrefixName{compile-missing-figures.sh}'.} + \message{[robExt] Manual mode enabled: please, manually compile the images using \l__robExt_current_compilation_command_str or run 'bash \jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}'.} % Avoid writing the same command multiple times (might occur in environments that execute the % same command multiple times like align etc) \cs_if_exist:cTF {l__robExt_missing_figure_\l__robExt_current_compilation_command_str :}{}{ - \iow_now:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {\l__robExt_current_compilation_command_str}% a new line is automatically added + \ifdefined\robExtDoNotRedirectOutputInManuallyCompileMissingFigures% + \iow_now:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {\l__robExt_current_compilation_command_str}% a new line is automatically added + \else + \iow_now:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {(~\l__robExt_current_compilation_command_str~)~>~\robExtAddCachePathAndName{\robExtFinalHash-compilation.log}~2>&1}% a new line is automatically added + \fi \cs_gset:cn {l__robExt_missing_figure_\l__robExt_current_compilation_command_str :} {} \ifdefined\robExt@compile@parallel@after \gdef\robExt@compile@parallel@must@compile{} \seq_gput_right:Nx \g__robExt_files_compiled_in_parallel {\robExtAddCachePathAndName{\robExtFinalHash}} % Gets the line with the error for easier debugging \cs_gset:cx {g__robExt_lines_error_\robExtAddCachePathAndName{\robExtFinalHash}:} {\msg_line_number:} + \ifdefined\robExtPrintWholeFile + \cs_gset:cx {g__robExt_print_whole_file_\robExtAddCachePathAndName{\robExtFinalHash}:} {} + \fi \cs_gset:cx {g__robExt_compilation_command_\robExtAddCachePathAndName{\robExtFinalHash}:} {\l__robExt_current_compilation_command_str} \fi } - \else + \else% \bool_if:nTF { \sys_if_shell_unrestricted_p: || \cs_if_exist_p:N \robExtForceCompilation } { - \message{[robExt] We ~ will ~ start ~ the ~ compilation using: ~ \l__robExt_current_compilation_command_str.} - \sys_shell_now:x {\l__robExt_current_compilation_command_str} % The ~ are used in ExplSyntaxOn to add space + % For a better debugging, we create a new file: + \ifdefined\robExtDoNotRedirectOutput% + \sys_shell_now:x {\robExtPrefixAllCompilationCommands \l__robExt_current_compilation_command_str}% + \else + \sys_shell_now:x {\robExtPrefixAllCompilationCommands (~\l__robExt_current_compilation_command_str~)~>~\robExtAddCachePathAndName{\robExtFinalHash-compilation.log}~2>&1}% + \fi + \message{[robExt] We ~ will ~ start ~ the ~ compilation ~ using: ~ \l__robExt_current_compilation_command_str.}% %% We notify that we are running the compilation command, this way it is possible to check later %% if the file is not present because of some compilation error or because we are in manual mode %% or fallback @@ -1457,8 +1786,12 @@ if __name__ == '__main__': % Avoid writing the same command multiple times (might occur in environments that execute the % same command multiple times like align etc) \cs_if_exist:cTF {l__robExt_missing_figure_\l__robExt_current_compilation_command_str :}{}{ - \message{[robExt] Fallback to manual mode: please, manually compile the images using \l__robExt_current_compilation_command_str or run 'bash \jobname-\robExtAddPrefixName{compile-missing-figures.sh}'.} - \iow_now:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {\l__robExt_current_compilation_command_str}% a new line is automatically added + \message{[robExt] Fallback to manual mode: please, manually compile the images using \l__robExt_current_compilation_command_str or run 'bash \jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}'.} + \ifdefined\robExtDoNotRedirectOutputInManuallyCompileMissingFigures% + \iow_now:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {\l__robExt_current_compilation_command_str}% a new line is automatically added + \else + \iow_now:Nx \g__robExt_write_manually_compile_all_missing_figures_iow {(~\l__robExt_current_compilation_command_str~)~>~\robExtAddCachePathAndName{\robExtFinalHash-compilation.log}~2>&1}% a new line is automatically added + \fi \cs_gset:cn {l__robExt_missing_figure_\l__robExt_current_compilation_command_str :} {} \ifdefined\robExt@compile@parallel@after \gdef\robExt@compile@parallel@must@compile{} @@ -1466,6 +1799,9 @@ if __name__ == '__main__': \fi } \else + \ifdefined\robExtPrintSourceWhenSaving + \typeout{Compilation~command~that~we~would~have~run:^^J\l__robExt_current_compilation_command_str^^J} + \fi \msg_error:nn{robExt}{need shell escape} \fi } @@ -1523,10 +1859,29 @@ if __name__ == '__main__': % Check if we tried to run a compilation command at the previous step: \cs_if_exist:NTF \l__robExt_I_just_ran_a_compilation_command: { % We ran a compilation command but it failed: we print an error message - \msg_error:nnxxx{robExt}{missing compiled pdf parallel}{\robExtAddCachePathAndName{\robExtFinalHash}}{\msg_line_number:}{\l__robExt_current_compilation_command_str} + % We first check if an error file has been produced: + \file_if_exist:nTF {\robExtAddCachePathAndName{\robExtFinalHash-compilation.log}} { + % We print the error twice as some editor might display only the first error while in others + % it might be easier to see the last error. For instance, in emacs if we do not do that + % then it first prints the error message in a file in the cache (but it forgets the + % robustExternalize prefix) + % But first we get the lines containing the word error: + \robExt_get_errors_from_file:n {\robExtAddCachePathAndName{\robExtFinalHash-compilation.log}}% + % We print the message before the log because otherwise emacs is confused and tries to open the + % auxiliary cached file, and I don't want that. + \ifdefined\robExtHideFirstErrorMessage\else + \msg_error:nnxxxx{robExt}{missing compiled pdf parallel with log}{\robExtAddCachePathAndName{\robExtFinalHash}}{\msg_line_number:}{\l__robExt_current_compilation_command_str}{below~(you~might~need~to~press~ENTER~to~go~to~the~next~error)} + \fi + \message{--------~We~print~now~the~full~log~--------^^J} + \robExt_write_file_in_log:n {\robExtAddCachePathAndName{\robExtFinalHash-compilation.log}}% + \message{--------~End~of~the~full~log~--------^^J} + \msg_error:nnxxxx{robExt}{missing compiled pdf parallel with log}{\robExtAddCachePathAndName{\robExtFinalHash}}{\msg_line_number:}{\l__robExt_current_compilation_command_str}{above} + }{ + \msg_error:nnxxx{robExt}{missing compiled pdf parallel}{\robExtAddCachePathAndName{\robExtFinalHash}}{\msg_line_number:}{\l__robExt_current_compilation_command_str} + }% } { % We ran no compilation command: we print instead a placeholder depending on the context: \cs_if_exist:NTF \robExt@compile@parallel@must@compile { - % we are supposed to compile the current picture in parallel, let'us check if it will be possible: + % we are supposed to compile the current picture in parallel, let us check if it will be possible: \bool_if:nTF { \sys_if_shell_unrestricted_p: || \cs_if_exist_p:N \robExtForceCompilation} { \robExtImagePlaceholderIfParallelCompilation }{ @@ -1535,10 +1890,10 @@ if __name__ == '__main__': }{ \cs_if_exist:NTF \robExtManualMode { \robExtImagePlaceholderIfManualMode - \message{[robExt] ~ You ~ are ~ in ~ manual ~ mode: ~ please ~ compile ~ yourself ~ \robExtAddCachePathAndName{\robExtFinalHash.tex} ~ or ~ use ~ the ~ bash ~ \jobname-\robExtAddPrefixName{compile-missing-figures.sh}} + \message{[robExt] ~ You ~ are ~ in ~ manual ~ mode: ~ please ~ compile ~ yourself ~ \robExtAddCachePathAndName{\robExtFinalHash.tex} ~ or ~ use ~ the ~ bash ~ \jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}} }{ \robExtImagePlaceholderIfFallbackMode - \message{[robExt] ~ You ~ are ~ falling ~ back ~ to ~ manual ~ mode: ~ please ~ compile ~ yourself ~ \robExtAddCachePathAndName{\robExtFinalHash.tex} ~ or ~ use ~ the ~ bash ~ \jobname-\robExtAddPrefixName{compile-missing-figures.sh}} + \message{[robExt] ~ You ~ are ~ falling ~ back ~ to ~ manual ~ mode: ~ please ~ compile ~ yourself ~ \robExtAddCachePathAndName{\robExtFinalHash.tex} ~ or ~ use ~ the ~ bash ~ \jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}} } } } @@ -1634,7 +1989,7 @@ if __name__ == '__main__': } \let\autoForwardMacro\robExtAutoForwardMacro -\NewDocumentCommand{\robExtLoadAutoForwardMacroConfig}{m}{ +\NewDocumentCommand{\robExtLoadAutoForwardMacroConfig}{+m}{ %\str_set:Nx \l__robExt_tmp_str {\cs_to_str:N #1} \cs_if_exist:cTF {l__robExt_execute_if_macro_present\string#1}{ % if the macro is present twice, we want to run \forward only once @@ -1660,16 +2015,21 @@ if __name__ == '__main__': %% "auto forward" \NewDocumentCommand{\robExtAutoForward}{}{ - \ifdefined\robExtUserInputCacheMe\else - \msg_warning:nn{robExt}{auto forward not in cachemecode} - \tl_set_rescan:NnV \robExtUserInputCacheMe {} \l__robExt_placeholder___ROBEXT_MAIN_CONTENT_ORIG___str + % some code will automatically add auto forward, but we don't want to run it twice. + \robExtDebugInfo{Running auto forward.} + \ifdefined\robExt@already@ran@autoforward\robExtDebugInfo{Auto forward already ran}\else + \ifdefined\robExtUserInputCacheMe\else + \msg_warning:nn{robExt}{auto forward not in cachemecode} + \tl_set_rescan:NnV \robExtUserInputCacheMe {} \l__robExt_placeholder___ROBEXT_MAIN_CONTENT_ORIG___str + \fi + \robExt@normalBraces\robExtUserInputCacheMe + \expandafter\robExt@getfromstringA\robExtUserInputCacheMe\robExt@getfromstringA%\robExt@getfromstringA is added to know when to stop + \def\robExt@already@ran@autoforward{}% \fi - \robExt@normalBraces\robExtUserInputCacheMe - \expandafter\robExt@getfromstringA\robExtUserInputCacheMe\robExt@getfromstringA%\robExt@getfromstringA is added to know when to stop } % https://tex.stackexchange.com/questions/700834/efficiently-program-search-of-macro-in-string/700844 -\def\robExt@getfromstringA#1{\ifx#1\robExt@getfromstringA \else +\long\def\robExt@getfromstringA#1{\ifx#1\robExt@getfromstringA \else %\ifcsname L:\string#1\endcsname \addto\listmacros{#1}\fi \robExtLoadAutoForwardMacroConfig{#1}% \expandafter\robExt@getfromstringA\fi @@ -1677,7 +2037,7 @@ if __name__ == '__main__': \def\robExt@normalBraces#1{{\catcode`{=12 \catcode`}=12 \everyeof={\endfile}% \expandafter\robExt@normalBracesA\expandafter#1\scantokens\expandafter{#1}}} -\def\robExt@normalBracesA#1#2\endfile{\gdef#1{#2}} +\long\def\robExt@normalBracesA#1#2\endfile{\gdef#1{#2}} %%% To automatically define and forward \NewDocumentCommand{\newcommandAutoForward}{moomO{}}{ @@ -1774,33 +2134,57 @@ if __name__ == '__main__': } \NewDocumentCommand{\defAutoForward}{mO{}mO{}}{ - \def#1#2{#3} - \robExtAutoForwardMacro{#1}[#4] + \def#1#2{#3}% + \robExtAutoForwardMacro{#1}[#4]% } -% \robExtGenericAutoForward[tikz]{string to match}[additional style to run]{ +% \robExtGenericAutoForward[tikz][namespace]{string to match}[additional style to run]{ % code to run in cached file if string matches, and to always run in current folder if not using % the star version % } \ExplSyntaxOff -\NewDocumentCommand{\robExtGenericAutoForward}{sO{latex}mO{}m}{% - \IfBooleanTF{#1}{}{#5}% We run the code right now - \robExt@set@hash@robust\zxTmpMacro{#5}% + +\NewDocumentCommand{\definecolorAutoForward}{mmmO{}}{% + \definecolor{#1}{#2}{#3}% + \robExtConfigure{if matches word={#1}{forward color=#1,#4}}% +} + +\NewDocumentCommand{\colorletAutoForward}{mmO{}}{% + \colorlet{#1}{#2}% + \robExtConfigure{if matches word={#1}{forward color=#1,#3}}% +} + + +\NewDocumentCommand{\robExtRunHereAndInPreambleOfCachedFiles}{O{latex}m}{% + #2% \robExtConfigure{% - add to preset={#2}{% - if matches word={#3}{ - command if externalization/.append code={ - \expanded{% - \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% - \expandonce{\zxTmpMacro}% - % #1%% - }% + add to preset={#1}{% + add to preamble={#2}, + },% + }% +} +\let\runHereAndInPreambleOfCachedFiles\robExtRunHereAndInPreambleOfCachedFiles + +\NewDocumentCommand{\robExtGenericAutoForward}{sO{latex}O{}mO{}m}{% + \IfBooleanTF{#1}{}{#6}% We run the code right now + \robExt@set@hash@robust\zxTmpMacro{#6}% + \expanded{% + \noexpand\robExtConfigure{% + register word with namespace={#3}{#4}{% + /utils/exec={% + \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% + \expandonce{\zxTmpMacro}% }% - },#4% + },% + #5% + },% + add to preset={#2}{% + auto forward words namespace={#3},% }% }% - }% + }% } + \let\genericAutoForward\robExtGenericAutoForward % uses "if matches" instead of "if matches word" @@ -1810,7 +2194,7 @@ if __name__ == '__main__': \robExtConfigure{% add to preset={#2}{% if matches={#3}{ - command if externalization/.append code={ + run command if externalization={ \expanded{% \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% \expandonce{\zxTmpMacro}% @@ -1840,8 +2224,120 @@ if __name__ == '__main__': \str_if_in:NnTF \l__robExt_placeholder___ROBEXT_MAIN_CONTENT_ORIG___str {#1} {\pgfkeysalso{#2}} {} } +% \robExtRegisterWord {namespace} {word} {style} +\NewDocumentCommand{\robExtRegisterWord}{mmm}{ + % \robExt_register_match_word:nnn {#1} {#2} {\pgfkeysalso{#3}} + \robExtRegisterWordCode{#1}{#2}{\pgfkeysalso{#3}}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Automatically forward (word-based) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% For efficiency reasons, we first extract in a single pass all words in the text (a word is basically [A-Za-z]+) +% and run a function on these words + +%%% I tried this, but it is really slow (500x slower than if_string_matches, overall 20% increase of +%%% compilation time) +% % \__robExt_auto_forward_words:N \commandToRunOnEachWord \stringToSearchOn +% \cs_set:Nn \__robExt_auto_forward_words:NN { +% % \l_tmpa_str will contain the current word read so far +% \str_set:Nn \l_tmpa_str {}% +% \str_map_inline:Nn #2 { +% % \token_case_charcode:NnTF ##1 {} {} {} +% \__robExt_if_letter:nTF {##1} { +% \str_put_right:Nn \l_tmpa_str {##1} +% }{ +% \str_if_empty:NTF \l_tmpa_str { } { +% % if the string is empty, we run the command on the string +% #1 \l_tmpa_str% +% \str_set:Nn \l_tmpa_str {}% we reset its value +% } +% } +% } +% } + +% %% \__robExt_if_letter:nTF {char} {true} {false} tests if an element is a letter +% %% https://tex.stackexchange.com/a/700864/116348 +% \prg_new_conditional:Npnn \__robExt_if_letter:n #1 { TF } +% { +% \bool_lazy_or:nnTF +% { +% \bool_lazy_and_p:nn +% { \int_compare_p:nNn { `#1 } > { `a - 1 } } +% { \int_compare_p:nNn { `#1 } < { `z + 1 } } +% } +% { +% \bool_lazy_and_p:nn +% { \int_compare_p:nNn { `#1 } > { `A - 1 } } +% { \int_compare_p:nNn { `#1 } < { `Z + 1 } } +% } +% \prg_return_true: +% \prg_return_false: +% } + +% % \robExt_register_match_word {namespace that defaults to empty} {word} {code to run if word is present} +% \cs_set:Nn \robExt_register_match_word:nnn { +% \cs_set:cn {l__robExt_execute_if_word_present_#1_#2:} {#3} +% } + +% % \robExt_try_to_execute_if_match_word:nn {namespace} {word} +% \cs_set:Nn \robExt_try_to_execute_if_match_word:nn { +% \cs_if_exist:cTF {l__robExt_execute_if_word_present_#1_#2:} {% +% \cs_if_exist:cTF {l__robExt_execute_if_word_present_#1_#2__already_forwarded:}{\message{Already forwarded}}{ +% \use:c {l__robExt_execute_if_word_present_#1_#2:}% +% % define it so that we do not import twice next time +% \cs_set:cx {l__robExt_execute_if_word_present_#1_#2__already_forwarded:} {} +% } +% } { } +% } +% \cs_generate_variant:Nn \robExt_try_to_execute_if_match_word:nn { nV } + +% \NewDocumentCommand{\robExtAutoForwardWords}{O{}}{ +% \cs_set:Nn \__robExt_tmp_fct:N { +% \robExt_try_to_execute_if_match_word:nV {#1} ##1 +% } +% \__robExt_auto_forward_words:NN \__robExt_tmp_fct:N \l__robExt_placeholder___ROBEXT_MAIN_CONTENT_ORIG___str +% } + +% \robExtAutoForwardWords[namespace] +\NewDocumentCommand{\robExtAutoForwardWords}{m}{% + % needed or the original string will be changed + \let\robExt@tmpString\l__robExt_placeholder___ROBEXT_MAIN_CONTENT_ORIG___str% + \robExt@scanmacro@find@word{#1}\robExt@tmpString% +} + \ExplSyntaxOff +% Thanks a lot wipet for this optimized version!! +% https://tex.stackexchange.com/questions/701351/more-efficient-string-extraction-of-words/701441#701441 +\def\robExtWordSeparators{{ };:."?!@+-/*,=\{\}[]\\'()&|~_^<>} + +% Not for user, use \robExtAutoForwardWords +% \robExt@scanmacro@find@word{namespace}\stringToParse +\def\robExt@scanmacro@find@word#1#2{% + \def\robExt@namespace{#1}% + % we will change the lccode (basically ascii code) of some characters like +- to delimit what a word is + % supposed to be. Since we do not want to affect other stuff, we put it in a bgroup. + \bgroup \expandafter\robExt@set@to@comma\robExtWordSeparators\relax% + \ifdefined\robExtAdditionalCodeInScanMacroFindWord\robExtAdditionalCodeInScanMacroFindWord\fi% + % This seems to set the string in lower case, so fill or Fill or get triggered. But it is not what we want here. + % \lowercase\expandafter{\expandafter\gdef\expandafter#2\expandafter{#2}}% + \lowercase\expandafter{\expandafter\gdef\expandafter#2\expandafter{#2}}% + \edef#2{\detokenize\expandafter{#2}}% + % \message{\string#2: \meaning#2} % prints the modified format of the scanned macro + \expandafter\egroup% + \expandafter\robExt@wordscan@aux#2,\relax,% +} +\def\robExt@set@to@comma #1{\ifx\relax#1\else \lccode`#1=`, \expandafter\robExt@set@to@comma\fi} +\def\robExt@wordscan@aux#1,{\ifx\relax#1\empty\else% + %\message{{#1}} % prints each scanned "word" + \ifcsname robExt@action@to@run@on@word:\robExt@namespace:#1\endcsname \csname robExt@action@to@run@on@word:\robExt@namespace:#1\endcsname \fi% + \expandafter\robExt@wordscan@aux\fi% +} +%\robExtRegisterWordCode{namespace}{word}{code} +\def\robExtRegisterWordCode#1#2#3{\expandafter\gdef\csname robExt@action@to@run@on@word:\string#1:\string#2\endcsname{#3}} + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Interface %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1864,10 +2360,16 @@ if __name__ == '__main__': \robExtEvalPlaceholderReplaceFromList{__ROBEXT_TMP__}{% \pgfkeys{% /robExt/.cd, - #1/.append style={__ROBEXT_TMP__},% + #1/.append style={% + % Some styles run differently if inside a preset or not, + % like if matches word. This macro helps with detecting it. + /utils/exec={\def\robExtCurrentlyDefiningPreset{}},% + __ROBEXT_TMP__% + },% }% }% \robExtRemovePlaceholder{__ROBEXT_TMP__}% let us clean our variables + \let\robExtCurrentlyDefiningPreset\undefined% }, new preset/.code 2 args={% \robExtStrSetDoubleHash{\robExtTmpStr}{#2}% @@ -1878,10 +2380,16 @@ if __name__ == '__main__': \robExtEvalPlaceholderReplaceFromList{__ROBEXT_TMP__}{% \pgfkeys{% /robExt/.cd,% - #1/.style={__ROBEXT_TMP__},% + #1/.style={% + % Some styles run differently if inside a preset or not, + % like if matches word. This macro helps with detecting it. + /utils/exec={\def\robExtCurrentlyDefiningPreset{}},% + __ROBEXT_TMP__% + },% }% }% \robExtRemovePlaceholder{__ROBEXT_TMP__}% let us clean our variables + \let\robExtCurrentlyDefiningPreset\undefined% }, % new compiled preset={latex compiled}{ % code to compile in order to produce the expected strings @@ -2025,8 +2533,8 @@ if __name__ == '__main__': %%%%%%%%%%%%% %%% Debug %%% %%%%%%%%%%%%% - more logs/.code={\def\robExtDebugMessage#1{\message{^^J[robExt] #1}}}, - less logs/.code={\def\robExtDebugMessage#1{}}, + more logs/.code={\def\robExtDebugMessage##1{\message{^^J[robExt] ##1}}\def\robExtDebugInfo##1{^^J[robExt] ##1}}, + less logs/.code={\def\robExtDebugMessage##1{}\def\robExtDebugInfo##1{}}, show placeholder/.code={\robExtShowPlaceholder{#1}}, show placeholders/.code={\robExtShowPlaceholders}, show placeholders contents/.code={\robExtShowPlaceholdersContents}, @@ -2116,6 +2624,27 @@ if __name__ == '__main__': recompile/.code={\def\robExtForceRecompilation{}}, do not recompile/.code={\let\robExtForceRecompilation\undefined}, set compilation command/.code={\robExtSetCompilationCommand{#1}}, + % like "set compilation command" but moves the "__ROBEXT_OUTPUT_PDF__-tmp" to "__ROBEXT_OUTPUT_PDF__" if + % there is no error. + set compilation command move if no error/.style={ + set compilation command/.expanded={#1 && \robExtMv\space"__ROBEXT_OUTPUT_PDF__-tmp" "__ROBEXT_OUTPUT_PDF__"} + }, + set compilation command create if no error/.code={\robExtSetCompilationCommand{#1 && echo "" > __ROBEXT_OUTPUT_PDF__}}, + do not redirect compilation output/.code={\def\robExtDoNotRedirectOutput{}\def\robExtDoNotRedirectOutputInManuallyCompileMissingFigures{}}, + print whole file in error message/.code={\def\robExtPrintWholeFile{}}, + do not print whole file in error message/.code={\let\robExtPrintWholeFile\undefined}, + prefix log message with/.code={\def\robExtPrefixLogMessage{#1}}, + spacing between lines in log/.code={\def\robExtMessageWithPrefixNumberLines{#1}}, + % This adds a ! in front of the code if \robExtPrintWholeFile is defined + logs should show as errors/.style={prefix log message with={!\space}}, + texstudio/.style={ + logs should show as errors, + spacing between lines in log={^^J^^J(sorry, these 4 empty lines are ugly but needed for texstudio to consider them as separate errors, customize me "with spacing between lines in log")^^J}, + }, + remove line number/.code={\def\robExtRemoveLineNumber{}}, % Removes the l. if the log error line starts with l.42 or it will disturb emacs. + do not remove line number/.code={\let\robExtRemoveLineNumber\undefined}, + remove line number, + nb lines after error to show/.code={\def\robExtLinesAfterError{#1}}, add argument to compilation command/.code={\robExtAddArgumentToCompilationCommand{#1}}, add arguments to compilation command/.style={ add argument to compilation command/.list={#1} @@ -2143,6 +2672,24 @@ if __name__ == '__main__': % The default include command includes the pdf, making sure it is raised depending on its depth, % but you can override it: custom include command/.code={\def\robExtIncludeCommand{#1}}, + include command is input/.style={ + custom include command={#1\input{\robExtAddCachePathAndName{\robExtFinalHash.pdf}}}, + }, + include command is input/.default={}, + % Sometimes (gnuplot), we need to include an image located in the cache folder: + % https://tex.stackexchange.com/questions/171587/append-entries-to-an-existing-graphicspath + add cache to graphicspath/.code={% + \appto\Ginput@path{\robExtCacheFolder}% + },% + %% This is needed notably if the cached elements are nested, like the include command uses itself a tikz picture + %% etc cached via \cacheTikz... It it hard to reset everything efficiently (like we might not want to reset + %% all compilation commands etc), so you can add here stuff that might need to be restored later. + reset/.code={% + \let\robExtIncludeCommandAdvanced\undefined% + \let\robExtIncludeCommand\undefined% + \let\robExtPrintWholeFile\undefined% + \setPlaceholder{__ROBEXT_INCLUDEGRAPHICS_FILE__}{\robExtAddCachePathAndName{\robExtFinalHash.pdf}}% + }, %% Use this when we do not want to include anything (e.g. the video will be processed later in the chain): do not include pdf/.style={ custom include command={}% @@ -2153,12 +2700,22 @@ if __name__ == '__main__': disable manual mode/.code={\let\robExtManualMode\undefined}, enable fallback to manual mode/.code={\def\robExtFallbackManualMode{}}, disable fallback to manual mode/.code={\let\robExtFallbackManualMode\undefined}, + % For the arxiv, we need to rename the source .tex into .tex-backup or it will be removed + backup source for arxiv/.code={\def\robExtEnableBackupSource{}}, + do not backup source for arxiv/.code={\let\robExtEnableBackupSource\undefined}, + rename backup files for arxiv/.code={\robExtRenameBackupFilesForArxiv{#1}}, + rename backup files for arxiv/.default={robExt-arxiv-files-to-rename.txt}, + % print in the log the file. Useful to debug in arxiv where we do not have any access to the logs + print source when saving/.code={\def\robExtPrintSourceWhenSaving{}}, + copy file to cache/.code={\robExtCopyFileToCache{#1}}, %% Arguments to include graphics include graphics args/.code={\def\robExtIncludeGraphicsArgs{#1}}, %% The role of this command is to set \l_robExt_result_str, that will contain the final string. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Configuration of the cache %%% - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % For support of --output-directory + set output directory/.code={\def\robExtOutputDirectory{#1}}, %% Configure the prefix (default to "robExt-") set filename prefix/.code={\def\robExtPrefixFilename{#1}}, % first argument is subfolder, second is how to get from subfolder to the folder containing the source: @@ -2171,6 +2728,13 @@ if __name__ == '__main__': % Change this before starting to cache any library, and if you change it mid-document, be aware % that you will not be able to refer to elements in the old folder. set subfolder and way back={robustExternalize/}{../}, + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%% Enable externalization for tikz %%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + cache tikz/.code={\robExtExternalizeAllTikzpictures{}}, + do not cache tikz/.code={\robExtDoNotExternalizeAllTikzpictures{}}, + cache tikz 2 args/.code 2 args={\robExtExternalizeAllTikzpictures[#1][#2]{}}, + cache tikz 3 args/.code n args={3}{\robExtExternalizeAllTikzpictures[#1][#2][3]{}}, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Disable externalization %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2191,9 +2755,20 @@ if __name__ == '__main__': %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Forward macros if externalization is enabled %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - command if externalization/.code={}, + command if externalization/.code={\def\robExt@we@are@already@in@command@if@externalization{}}, + % Doing "command if externalization/.append code={}" is not always good since we don't always know if the style + % will always be run before running "command if externalization". In particular this arrives when using + % something like "if matches word={mypink}{forward color=mypink}" + run command if externalization/.code={ + \ifdefined\robExt@we@are@already@in@command@if@externalization% + % we are already running command if externalization + #1% + \else% + \pgfkeysalso{command if externalization/.append code={#1}}% + \fi% + }, fw/.style={forward=#1}, - run code before main content if externalization enabled/.code={\message{#1}}, + run code before main content if externalization enabled/.code={}, % run code before main content if externalization enabled/.code={ % \message{aaa #1} % \def\zx@tmp{#1}% @@ -2213,7 +2788,7 @@ if __name__ == '__main__': % }, % }, forward/.style={% - command if externalization/.append code={% + run command if externalization={% \robExtGetCommandDefinitionInMacro{#1}% \expanded{% \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% @@ -2223,7 +2798,7 @@ if __name__ == '__main__': }, }, forward at letter/.style={% - command if externalization/.append code={% + run command if externalization={% \robExtGetCommandDefinitionInMacro{#1}% \expanded{% \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% @@ -2235,7 +2810,7 @@ if __name__ == '__main__': }, }, forward eval/.style={% - command if externalization/.append code={% + run command if externalization={% \expanded{% \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% \noexpand\def\noexpand#1{#1}% @@ -2244,7 +2819,7 @@ if __name__ == '__main__': },% }, forward counter/.style={% - command if externalization/.append code={% + run command if externalization={% \expanded{% \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% \noexpand\makeatletter% @@ -2256,8 +2831,23 @@ if __name__ == '__main__': }% },% },% + % Useful when we want to force the value of a forwarded counter. Useful for arXiv, e.g. + % if the page number is not the good one. + forward counter force value/.style 2 args={% + run command if externalization={% + \expanded{% + \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% + \noexpand\makeatletter% + % Make sure the counter exists: + \noexpand\ifcsname c@#1\noexpand\endcsname\noexpand\else\noexpand\newcounter{#1}\noexpand\fi% + \noexpand\setcounter{#1}{#2}% + \noexpand\makeatother + }% + }% + },% + },% forward color/.style={ - command if externalization/.append code={% + run command if externalization={% \extractcolorspecs{#1}{\zx@tmp@model}{\zx@tmp@cmd}% \expanded{% \noexpand\robExtAddBeforePlaceholder*{__ROBEXT_MAIN_CONTENT__}{% @@ -2268,19 +2858,47 @@ if __name__ == '__main__': },% %% This will try to automatically forward some macros. For this, you must first define %% - auto forward/.code={\robExtAutoForward}, + auto forward only macros/.code={\robExtAutoForward}, + auto forward/.code={\robExtAutoForward\pgfkeysalso{auto forward words}}, auto forward color/.style 2 args={% - add to preset={#1}{ - % if matches={\b #2\b}{forward color=#2}, - % the Regex is maybe more precise (avoid unnecessary forwards) but is way faster - if matches={#2}{forward color=#2}, + add to preset={#1}{% + if matches word={#2}{forward color=#2}, }, }, load auto forward macro config/.code={\robExtLoadAutoForwardMacroConfig{#1}}, + %% Auto forward words + auto forward words namespace/.code={% + \ifdefined\robExt@autoforward@enabled\else% + \pgfkeysalso{command if externalization/.append code={% + \ifdefined\robExt@autoforward@enabled% + \expanded{\noexpand\robExtAutoForwardWords{\robExt@autoforward@enabled}}% + \fi% + }% + }% + \fi% + \def\robExt@autoforward@enabled{#1}% + },%%% todo: finish + auto forward words/.style={auto forward words namespace={}}, %% This will if matches regex/.code 2 args={\robExtIfMatchesRegex{#1}{#2}}, - if matches word/.code 2 args={\robExtIfMatchesString{#1}{#2}}, if matches/.code 2 args={\robExtIfMatchesString{#1}{#2}}, + if matches word/.code 2 args={% + \robExtRegisterWord{}{#1}{#2}% + % If ran inside a preset, we want to enable it, otherwise we enable it on the latex preset + \ifdefined\robExtCurrentlyDefiningPreset% + \pgfkeysalso{auto forward words}% + \else% + \pgfkeysalso{/robExt/latex/.append style={auto forward words}}% + \fi% + }, + % more efficient since we can register the words before the preset, but make sure to call `auto forward words namespace`. + % You can use an empty namespace. + register word with namespace/.code n args={3}{% + \robExtRegisterWord{#1}{#2}{#3}% + }, + register word/.style 2 args={% + register word with namespace={}{#1}{#2},% + }, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Run code before/after inclusion %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -2320,12 +2938,12 @@ if __name__ == '__main__': compile in parallel command/.store in=\robExt@compile@parallel@command, % Different backends to compile in parallel compile in parallel with gnu parallel/.style={ - compile in parallel command={parallel --jobs #1 :::: '\jobname-\robExtAddPrefixName{compile-missing-figures.sh}'}, + compile in parallel command={parallel --jobs #1 :::: '\jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}'}, }, compile in parallel with gnu parallel/.default={200\%}, compile in parallel with xargs/.style={ % Use " instead of ' as Windows does not consider ' as a valid surrounding for strings - compile in parallel command={xargs -t -I "{}" -P #1 \robExtParallelShell\space "{}" < "\jobname-\robExtAddPrefixName{compile-missing-figures.sh}"}, + compile in parallel command={xargs -t -I "{}" -P #1 \robExtParallelShell\space "{}" < "\jobnameNoQuotes-\robExtAddPrefixName{compile-missing-figures.sh}"}, }, % With 0 it spawns as many shells at possible, i.e. it compiles all 200 pictures at the same time, making the % system a laggy, and it is actually *slower* (2:05mn vs 1:15mn) than when using 16 threads. @@ -2361,12 +2979,36 @@ if __name__ == '__main__': \iow_close:N \g__robExt_write_manually_compile_all_missing_figures_iow \msg_warning:nnx{robExt}{rerun because parallel}{\robExt@compile@parallel@command} \message{\robExt@compile@parallel@command} - \sys_shell_now:x {\robExt@compile@parallel@command} + % Note that we do not save this into a file because it might help to see in real time where we are in + % the compilation process. This also means that we get poorer error message if this specific + % command fails in texstudio since it only prints the log file and not the whole terminal... + % Since this should anyway be quite rare (user has not xargs installed basically), this should be fine. + \sys_shell_now:x {\robExtPrefixAllCompilationCommands\robExt@compile@parallel@command} % We check if some files failed to compile \seq_map_inline:Nn \g__robExt_files_compiled_in_parallel { - \message{#1} \file_if_exist:xTF{#1.pdf}{}{ - \msg_error:nnxxx{robExt}{missing compiled pdf parallel}{#1}{\use:c {g__robExt_lines_error_#1:}}{\use:c {g__robExt_compilation_command_#1:}} + \file_if_exist:nTF {#1-compilation.log} { + % We print the error twice as some editor might display only the first error while in others + % it might be easier to see the last error. For instance, in emacs if we do not do that + % then it first prints the error message in a file in the cache (but it forgets the + % robustExternalize prefix) + % But first we get the lines containing the word error: + \let\robExtPrintWholeFile\undefined + \cs_if_exist:cTF {g__robExt_print_whole_file_#1:} {\def\robExtPrintWholeFile{}} {} + \robExt_get_errors_from_file:n {#1-compilation.log}% + % We print the message before the log because otherwise emacs is confused and tries to open the + % auxiliary cached file, and I don't want that. + \ifdefined\robExtHideFirstErrorMessage\else + \msg_error:nnxxxx{robExt}{missing compiled pdf parallel with log}{#1}{\use:c {g__robExt_lines_error_#1:}}{\use:c {g__robExt_compilation_command_#1:}}{below~(you~might~need~to~press~ENTER~to~go~to~the~next~error)} + \fi + \message{--------~We~print~now~the~full~log~--------^^J} + \robExt_write_file_in_log:n {#1-compilation.log}% + \message{--------~End~of~the~full~log~--------^^J} + \msg_error:nnxxxx{robExt}{missing compiled pdf parallel with log}{#1}{\use:c {g__robExt_lines_error_#1:}}{\use:c {g__robExt_compilation_command_#1:}}{above} + \let\robExtPrintWholeFile\undefined + }{ + \msg_error:nnxxx{robExt}{missing compiled pdf parallel}{#1}{\use:c {g__robExt_lines_error_#1:}}{\use:c {g__robExt_compilation_command_#1:}} + } } } } { @@ -2378,6 +3020,18 @@ if __name__ == '__main__': } \fi \fi + % \robExtBackupSource moves the source .tex into .tex-backup, needed for the arXiv website that removes the + % .pdf if there is a .tex file. + % We need to run it at the very end, as if we move it right after a cacheMe, we cannot refer anymore to the + % input file of this block later. + \iow_close:N \g__robExt_write_list_all_figures_iow + \ifdefined\robExtEnableBackupSource% + \ior_open:Nn \g__robExt_read_ior {\jobnameNoQuotes-\robExtAddPrefixName{all-figures.txt}}% + \ior_str_map_inline:Nn \g__robExt_read_ior {% + \robExtBackupSource{#1}% + }% + \ior_close:N \g__robExt_read_ior + \fi% } \ExplSyntaxOff @@ -2401,17 +3055,22 @@ if __name__ == '__main__': \ifdefined\robExtExecuteNamedOutput\robExtExecuteNamedOutput\fi% \ifdefined\robExtExecuteAfter\robExtExecuteAfter\fi% \fi% - \message{Finished to include the file.}% + \robExtDebugInfo{Finished to include the file.}% } %% #1: Arguments, #2: content to externalize -\NewDocumentCommand{\robExtCacheMe}{O{}m}{% +\NewDocumentCommand{\robExtCacheMe}{O{}+m}{% {% Group %% We store the input in a non-string element for efficiently implementing "auto forward" \edef\robExtUserInputCacheMe{\unexpanded{#2}}% \unexpanded is needed if the macro contains a #1 \pgfkeys{% /robExt/.cd,% + %% This is needed notably if the cached elements are nested, like the include command uses itself a tikz + %% picture etc cached via \cacheTikz... It it hard to reset everything efficiently (like we might not + %% want to reset all compilation commands etc), so you can add here stuff that might need to be restored + %% later. + reset, set placeholder={__ROBEXT_MAIN_CONTENT_ORIG__}{#2},% default style,% #1, @@ -2637,12 +3296,16 @@ __ROBEXT_LATEX_WRITE_DEPTH_TO_OUT_FILE__% enable placeholders, % This way it appears before orig in the list: more efficient import placeholders from group={latex}, + %/utils/exec={\message{I am in the latex style!!!!!!}}, set placeholder={__ROBEXT_MAIN_CONTENT__}{__ROBEXT_MAIN_CONTENT_ORIG__}, import placeholder={__ROBEXT_MAIN_CONTENT_ORIG__}, first placeholders latex, set template={__ROBEXT_LATEX__}, set compilation command={__ROBEXT_LATEX_COMPILATION_COMMAND__}, %% Configure the latex compilation engine + add to compilation command options/.style={ + add to placeholder={__ROBEXT_LATEX_COMPILATION_COMMAND_OPTIONS__}{#1}, + }, use latexmk/.style={ set placeholder={__ROBEXT_LATEX_ENGINE__}{latexmk}, }, @@ -2787,9 +3450,9 @@ def finished_with_no_error(): created (otherwise robust-externalize will think that the compilation failed) ''' if not os.path.exists(get_filename_from_extension(".pdf")): - # we create an empty path + # we create a nearly empty pdf (not empty or arxiv will remove it) with open(get_filename_from_extension(".pdf"), 'w') as f: - pass + f.write("ok") ### Starting main content __ROBEXT_MAIN_CONTENT__ @@ -2810,6 +3473,7 @@ finished_with_no_error() \robExtConfigure{ python/.style={ enable placeholders, + print whole file in error message, import placeholders={__ROBEXT_PYTHON__,__ROBEXT_PYTHON_IMPORT__,__ROBEXT_PYTHON_MAIN_CONTENT_WRAPPED__,__ROBEXT_PYTHON_FINISHED_WITH_NO_ERROR__,__ROBEXT_PYTHON_EXEC__}, set compilation command={__ROBEXT_PYTHON_EXEC__ "__ROBEXT_SOURCE_FILE__"}, set template={__ROBEXT_PYTHON__}, @@ -2906,13 +3570,24 @@ print_file.close() \robExtClearGroupPlaceholders{main} +%% Inspired by +%% https://tex.stackexchange.com/questions/259247/rescaling-gnuplottex-to-fit-in-subfigure/259271 +\ExplSyntaxOn +\DeclareExpandableDocumentCommand{\robExtLenToCm}{ O{cm} m } +{ + \dim_to_decimal_in_unit:nn { #2 } { 1 #1 } #1 +} +\ExplSyntaxOff +\let\lenToCm\robExtLenToCm + \robExtConfigure{ verbatim text/.style={ enable placeholders, set template={__ROBEXT_MAIN_CONTENT__}, custom include command={\evalPlaceholder{\verbatiminput{\robExtAddCachePathAndName{\robExtFinalHash.tex}}}}, %% Apparently this works on windows as well https://stackoverflow.com/questions/1702762/how-can-i-create-an-empty-file-at-the-command-line-in-windows - set compilation command={echo "" > __ROBEXT_OUTPUT_PDF__}, + %% We do not want it to be empty or arXiv will remove the file. + set compilation command={echo "ok" > __ROBEXT_OUTPUT_PDF__}, }, verbatim text no include/.style={ verbatim text, @@ -2928,6 +3603,94 @@ print_file.close() %%%%%% +%%%%%% Group "gnuplot" +%%%%%% + +% We clean the "main" group, that we will copy later to gnuplot. +\robExtClearGroupPlaceholders{main} + +\begin{PlaceholderFromCode}*{__GNUPLOT_TEMPLATE__} +set terminal __ROBEXT_GNUPLOT_TERMINAL__ +set output "__ROBEXT_GNUPLOT_OUTPUTFILE__" +set loadpath "__ROBEXT_WAY_BACK__" +__ROBEXT_GNUPLOT_PRELUDE__ +__ROBEXT_MAIN_CONTENT__ +\end{PlaceholderFromCode} + +\begin{PlaceholderFromCode}{__ROBEXT_GNUPLOT_PRELUDE__} +\end{PlaceholderFromCode} + +\robExtCopyGroupPlaceholders{gnuplot}{main} +\robExtRegisterGroupPlaceholders{gnuplot} + +\robExtConfigure{ + new preset={gnuplot}{ + enable placeholders, + print whole file in error message, + import placeholders from group={gnuplot}, + set compilation command={gnuplot -c "__ROBEXT_SOURCE_FILE__" && echo "ok" > "__ROBEXT_OUTPUT_PDF__"}, + set terminal/.style={ + set placeholder={__ROBEXT_GNUPLOT_TERMINAL__}{#1}, + }, + % The extension is important. Notably, the cairolatex expects a .tex. + set filename/.style={ + set placeholder={__ROBEXT_GNUPLOT_OUTPUTFILE__}{__ROBEXT_OUTPUT_PREFIX__-gnuplot-#1}, + set placeholder={__ROBEXT_INCLUDEGRAPHICS_FILE__}{\robExtAddCachePathAndName{\robExtFinalHash-gnuplot-#1}}, + }, + pdf terminal/.style={ + set terminal={pdf #1}, + set filename={.pdf}, + }, + pdf terminal/.default={}, + pdf terminal, + is tex output/.style={ + set filename={.tex}, + add cache to graphicspath, % At least in cairolatex, we first need to input a file that includegraphics an image in the cache. + custom include command={\message{We will input the file \robExtAddCachePathAndName{\robExtFinalHash-gnuplot-.tex}}\input{\robExtAddCachePathAndName{\robExtFinalHash-gnuplot-.tex}}}, + }, + tikz terminal/.style={ + set terminal={tikz #1}, + is tex output, + }, + tikz terminal/.default={}, + % Warning: you cannot define this option with the name "tikz" if you try to nest elements, for instance + % if the include command calls an \input that calls a tikz picture, that is cached by \cacheTikz and therefore + % call the "tikz" preset that is now changed. + cairolatex terminal/.style={ + set terminal={cairolatex #1}, + is tex output, + }, + cairolatex terminal/.default={}, + set template={__GNUPLOT_TEMPLATE__}, + print verbatim if no externalization, + }, +} + + +% Like \gpgetvar but do not produce an error if the variable does not exist yet +% Fix https://github.com/leo-colisson/robust-externalize/issues/17 +\ExplSyntaxOn +\NewDocumentCommand{\robExtGpgetvar}{m}{% + \ifcsname gp@var@#1\endcsname% + \gpgetvar{#1}% + \else% + \msg_warning:nnx{robExt}{gpgetvar recompilation needed}{#1}% + \emph{Please~recompile~to~load~ variable:~}% + \texttt{\tl_to_str:n {#1}}% + \fi% +} +% Is useful if you want a number even if there is an error https://github.com/leo-colisson/robust-externalize/issues/17#issuecomment-1862556771 +% It must be expandable. +\NewExpandableDocumentCommand{\robExtGpgetvarNb}{sO{404}m}{% + \ifcsname gp@var@#3\endcsname% + \gpgetvar{#3}% + \else% We cannot print a waring or siunit will complain. + \sys_if_engine_luatex:TF{\directlua{texio.write_nl('Warning:~the~variable~#3~used~in~robExtGpgetvarNb~does~not~exist~yet.~Please~recompile.')}}{}#2% + \fi% +} +\ExplSyntaxOff + +%%%%%% %%%%%% Group "bash" %%%%%% @@ -2941,7 +3704,7 @@ outputTex="__ROBEXT_OUTPUT_PREFIX__-out.tex" outputPdf="__ROBEXT_OUTPUT_PDF__" __ROBEXT_MAIN_CONTENT__ # Create the pdf file to certify that no compilation error occured -touch "${outputPdf}" +echo "ok" > "${outputPdf}" \end{RobExtPlaceholderFromCode} \robExtSetPlaceholder{__ROBEXT_BASH_SHELL__}{bash} @@ -2949,6 +3712,7 @@ touch "${outputPdf}" \robExtConfigure{ bash/.style={ enable placeholders, + print whole file in error message, import placeholders={__ROBEXT_BASH_TEMPLATE__,__ROBEXT_BASH_SHELL__}, set compilation command={__ROBEXT_BASH_SHELL__ "__ROBEXT_SOURCE_FILE__"}, set template={__ROBEXT_BASH_TEMPLATE__}, @@ -2960,6 +3724,50 @@ touch "${outputPdf}" \robExtRegisterGroupPlaceholders{bash} %%%%%% +%%%%%% Group "web image", to download images automatically +%%%%%% + +\robExtClearGroupPlaceholders{main} + +% \begin{RobExtPlaceholderFromCode}{__ROBEXT_BASH_TEMPLATE__} +% # Quit if there is an error +% set -e +% outputTxt="__ROBEXT_OUTPUT_PREFIX__-out.txt" +% outputTex="__ROBEXT_OUTPUT_PREFIX__-out.tex" +% outputPdf="__ROBEXT_OUTPUT_PDF__" +% __ROBEXT_MAIN_CONTENT__ +% # Create the pdf file to certify that no compilation error occured +% echo "ok" > "${outputPdf}" +% \end{RobExtPlaceholderFromCode} + +\robExtConfigure{ + web image/.style={ + enable placeholders, + print whole file in error message, + wget/.style={ + set compilation command move if no error={wget "__ROBEXT_MAIN_CONTENT__" -O "__ROBEXT_OUTPUT_PDF__-tmp"}, + }, + curl/.style={ + set compilation command move if no error={curl "__ROBEXT_MAIN_CONTENT__" -L -o "__ROBEXT_OUTPUT_PDF__-tmp"}, + }, + if unix={ + wget + }, + if windows={ + curl + }, + set template={}, + } +} + +\NewDocumentCommand{\robExtIncludegraphicsWeb}{D<>{}O{}m}{\robExtCacheMe[web image,set includegraphics options={#2},#1]{#3}} +\let\includegraphicsWeb\robExtIncludegraphicsWeb + +\robExtCopyGroupPlaceholders{web image}{main} +\robExtRegisterGroupPlaceholders{web image} + + +%%%%%% %%%%%% Group "default", available in all styles %%%%%% @@ -3063,6 +3871,7 @@ touch "${outputPdf}" } \NewDocumentCommand{\robExtExternalizeAllTikzpictures}{O{tikz}O{tikzpicture}O{<>}}{% + \robExtDoNotExternalizeAllTikzpictures% \robExtCacheEnvironment[#3]{tikzpicture}{#2}% % Tikz has a more complicated parsing system \DeclareCommandCopy{\robExtCommandOrigtikz}{\tikz}% we save the function for later reset @@ -3077,12 +3886,65 @@ touch "${outputPdf}" } \let\cacheTikz\robExtExternalizeAllTikzpictures +\NewDocumentCommand{\robExtDoNotExternalizeAllTikzpictures}{}{% + \ifdefined\robExtCommandOrigtikz% + \DeclareCommandCopy{\tikz}{\robExtCommandOrigtikz}% + \let\robExtCommandOrigtikz\undefined + \fi% + \ifdefined\robExtEnvironmentOrigtikzpicture% + \DeclareEnvironmentCopy{tikzpicture}{robExtEnvironmentOrigtikzpicture}% + \let\robExtEnvironmentOrigtikzpicture\undefined + \fi% +} +\let\doNotCacheTikz\robExtDoNotExternalizeAllTikzpictures + + %% The cached version \DeclareDocumentEnvironment{tikzpictureC}{D<>{}O{}O{}}{% \begin{CacheMe}{tikzpicture,#1}[#2]% }{\end{CacheMe}}% %%%%%% +%%%%%% Cache tikzit +%%%%%% + +\NewDocumentCommand{\robExtCacheTikzit}{O{tikzit}}{% + \ifdefined\robExtCommandOrigtikzfig\else% + \DeclareCommandCopy{\robExtCommandOrigtikzfig}{\tikzfig}% + \fi% + \robExtAddToCommandResetList{tikzfig}% + \DeclareDocumentCommand{\tikzfig}{D<>{}m}{% + % tikzit tries first ##2.tikz and fallsback to figures/##2.tikz otherwise. + \IfFileExists{##2.tikz}{\def\robExtTikzfigFile{##2}}{\def\robExtTikzfigFile{figures/##2}}% + \expanded{\noexpand\cacheMe[ + #1, + add dependencies/.expanded={\robExtTikzfigFile.tikz}, + ##1, + command if no externalization/.code={\noexpand\robExtDisableTikzpictureOverwrite\noexpand\robExtCommandOrigtikzfig{##2}}, + ]{\noexpand\tikzfig{__ROBEXT_WAY_BACK__\robExtTikzfigFile}}}% + }% +} +\let\cacheTikzit\robExtCacheTikzit + +\NewDocumentCommand{\robExtCacheTikzitWithStyle}{O{tikzit}m}{% + \robExtCacheTikzit[#1]% + \robExtConfigure{ + % First, we copy the tikzit-related files to the cache: + copy file to cache={tikzit.sty}, + copy file to cache={#2}, + % We create the tikzit preset loaded by default: + new preset={#1}{ + latex, + add to preamble={ + \usepackage{tikzit} + \input{#2} + }, + }, + }% +} +\let\cacheTikzitWithStyle\robExtCacheTikzitWithStyle + +%%%%%% %%%%%% The generic functions %%%%%% @@ -3090,7 +3952,8 @@ touch "${outputPdf}" \NewDocumentCommand{\robExtCacheEnvironment}{O{<>}mm}{% %% We need to save the original environment to avoid infinite recursion if we disable externalization %% https://tex.stackexchange.com/questions/695391/why-isnt-my-environment-restored/695398 - \NewEnvironmentCopy{robExtEnvironmentOrig#2}{#2}% + \ifcsname robExtEnvironmentOrig#2\endcsname\PackageWarning{Your are trying to cache an environment #2 that seems to be already cached... Expect weird things to happen.}{}\fi + \DeclareEnvironmentCopy{robExtEnvironmentOrig#2}{#2}% \robExtAddToEnvironmentResetList{#2}% \DeclareDocumentEnvironment{#2}{D#1{}}{% \def\robExtEnvironmentOrigName{#2}% diff --git a/macros/latex/contrib/robust-externalize/robust-externalize.tex b/macros/latex/contrib/robust-externalize/robust-externalize.tex index 58d64342c5..f06333b9fe 100644 --- a/macros/latex/contrib/robust-externalize/robust-externalize.tex +++ b/macros/latex/contrib/robust-externalize/robust-externalize.tex @@ -1,3 +1,4 @@ +%\pdfoutput=1% Do not remove, needed for arxiv \documentclass[a4paper,doc2]{ltxdoc} % doc2 is needed to force the old version, or links get colored in a weird red way even with hidelinks. https://github.com/latex3/latex2e/issues/822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -10,15 +11,24 @@ \usepackage{amsmath} \usepackage[margin=3cm]{geometry} \usepackage{calc} +\usepackage{siunitx} \usepackage{tikz} +\usepackage{tikzit} +\input{new_zxstyle.tikzstyles} \usetikzlibrary{shadows,fit} % \usetikzlibrary fails because file is not in current directory, lazy to setup TEXINPUTS \makeatletter \usepackage{robust-externalize} \makeatother \robExtConfigure{ - enable optimizations -} + enable optimizations, + copy file to cache={zx-calculus.sty}, + copy file to cache={tikzlibraryzx-calculus.code.tex}, + % You need to uncomment that line to rename the .tex files into .tex-backup + % backup source for arxiv, + rename backup files for arxiv, + print source when saving, % debug +} \usepackage{zx-calculus} \usepackage{forest} \setlength{\marginparwidth}{2cm} @@ -26,6 +36,7 @@ % Loads the great package that produces tikz-like manual (see also tikzcd for examples) \input{pgfmanual-en-macros.tex} % Is supposed to be included in recent TeX distributions, but I get errors... +\usepackage{gnuplot-lua-tikz} %% Generate with gnuplot -e "set terminal tikz createstyle" %% For verbatim environments: @@ -94,7 +105,7 @@ {\Large\bfseries Cache anything (\tikzname, tikz-cd, python…),\\in a robust, efficient and pure way.} \vspace{1em} - {Léo Colisson \quad Version 2.2}\\[3mm] + {Léo Colisson \quad Version 2.5}\\[3mm] {\href{https://github.com/leo-colisson/robust-externalize}{\texttt{github.com/leo-colisson/robust-externalize}}} \end{center} @@ -102,10 +113,11 @@ \bigskip -\textbf{WARNING: This library is young and might lack some testing (and is an important rewrite of a previous version), but v2.0 is definitely usable. Even if we try to stay backward compatible, the only guaranteed way to be immune to changes is to copy/paste the library in your main project folder. Please report any bug to \url{https://github.com/leo-colisson/robust-externalize}!} +\textbf{WARNING: Even if we try to stay backward compatible, the only guaranteed way to be 100\% immune to changes is to copy/paste the\ .sty file of the library in your main project folder. Please report any bug to \url{https://github.com/leo-colisson/robust-externalize}!} -\textbf{WARNING 2: the coming version 2.1 improves significantly the compilation time compared with 2.0 that was surprisingly slow. Now, it is fairly well optimized (but the code needs a bit of cleaning and documentation before doing an official release)} +\textbf{WARNING 2: the recent versions 2.1 and 2.2 improves significantly the compilation time compared with 2.0 that was surprisingly slow. Now, it is fairly well optimized, and version 2.3 is even more optimized.} +\textbf{WARNING 3: If you read this documentation from the arXiv or CTAN, you might prefer to read it from \mylink{https://github.com/leo-colisson/robust-externalize}{Github} to get the latest version.} \section{A taste of this library} @@ -118,7 +130,7 @@ This library allows you to cache any language: not only \LaTeX{} documents and \ enable fallback to manual mode, } \end{verbatim} -Then type something like this (note the |C| for |cached| at the end of |tikzpictureC|, see below to override the original command), and compile with |pdflatex -shell-escape yourfile.tex| (or \textcolor{red}{\textbf{read below if you do not want to use }}|-shell-escape|\textcolor{red}{\textbf{ (note that overleaf enables shell-escape by default, and it not needed once all pictures are cached)}}): +Then type something like this (note the |C| for |cached| at the end of |tikzpictureC|, see below to override the original tikz commands), and compile with |pdflatex -shell-escape yourfile.tex| (or \textcolor{red}{\textbf{read below if you do not want to use }}|-shell-escape|\textcolor{red}{\textbf{ (note that overleaf enables shell-escape by default, and it is not needed once all pictures are cached)}}): \begin{codeexample}[width=0pt,vbox] \robExtConfigure{ add to preset={tikz}{ @@ -128,11 +140,16 @@ Then type something like this (note the |C| for |cached| at the end of |tikzpict } The next picture is cached % \begin{tikzpictureC}[baseline=(A.base)] - \node[fill=red, rounded corners](A){My node that respects baseline \ding{164}.}; + \node[fill=red, rounded corners](A){My node respecting baseline \ding{164}.}; \node[fill=red, rounded corners, opacity=.3,overlay] at (A.north east){I am an overlay text}; \end{tikzpictureC} and you can see that overlay and depth works. \end{codeexample} +Since v2.3 we also provide a way to include online pictures with |\includegraphicsWeb|: +\begin{codeexample}[width=0pt,vbox] +Here is a picture of cat downloaded online: \includegraphicsWeb[width=3cm]{http://placekitten.com/400/300}. +\end{codeexample} + You can also cache arbitrary code (e.g.\ python). You can also define arbitrary compilation commands, inclusion commands, and presets to fit you need. For instance, you can create a preset to obtain: \begin{codeAndResult} @@ -145,7 +162,7 @@ for name in ["Alice", "Bob"]: Actually, we also provide this style by default (and explain how to write it yourself), just make sure to load: \begin{verbatim} \usepackage{pythonhighlight} -\usepackage{tcolorbox} +\usepackage[most]{tcolorbox} \end{verbatim} You can also cache any environment and command using something like: @@ -208,6 +225,17 @@ A ZX figure % } \end{codeAndResult} \end{itemize} + +We also provide methods to cache automatically \mylink{https://tikzit.github.io/}{TikZit} pictures (|\cacheCommand| alone would not be sufficient as the source relies on an external file): + +\begin{codeexample}[vbox] + %%%%%%% In your preamble: + \cacheTikzitWithStyle{new_zxstyle.tikzstyles} + + %%%%%%% In your document: + \tikzfig{demo} %figures/ can be omitted +\end{codeexample} + You can also cache all tikz pictures by default, except those that are run from some commands (as remember picture does not work yet, this is important). For instance, this code will allow you to freely use the |todonotes| package (that uses internally tikz but is not cachable with this library since it uses remember picture) while caching all other elements: \begin{codeexample}[code only] %% this will cache \tikz and tikzpictures by default (using the tikz preset) @@ -341,6 +369,13 @@ We also provide a number of other functionalities, among others: \item And more\dots \end{itemize} +\section{Acknowledgments} + +I am deeply indebted to many users on \url{tex.stackexchange.com} that made the writing of this library possible. I can't list you all, but thank you so much! A big thanks also to the project \url{https://github.com/sasozivanovic/memoize/} from which I borrowed most of the code to automatically wrap commands. Thanks to kiryph and dflvunoooooo for providing very useful feedbacks. + +\section{Support} + +If you find this library useful, please consider citing the arXiv version of this documentation, possibly using |\nocite|. If you want to support me financially and offer me a virtual coffee, you can use my \mylink{https://github.com/sponsors/tobiasBora}{GitHub sponsor page}. \section{Introduction} @@ -378,10 +413,10 @@ I tested the library on Linux and Windows, but the library should work on all OS \paragraph{Do I need to compile using -shell-escape?} -Since we need to compile the images via an external command, the simpler option is to add the argument |-shell-escape| to let the library run the compilation command automatically (this is also the case of \tikzname's externalize library). However, people worried by security issues of |-shell-escape| (that allows arbitrary code execution if you don't trust the \LaTeX{} code) might be interested by these facts: +Since we need to compile the images via an external command the first time, the simpler option is to add the argument |-shell-escape| to let the library run the compilation command automatically (this is also the case of \tikzname's externalize library). Note that overleaf already defines this option by default, so you don't need to do anything special in overleaf. Moreover, this is only needed \textbf{during the first compilation} since once the image is cached, |-shell-escape| is not needed anymore (therefore, on the arXiv website, you can upload the |robustExternalize| folder containing the cached images without any issue, see \cref{sec:arxiv} for details). However, people worried by security issues of |-shell-escape| (that allows arbitrary code execution if you don't trust the \LaTeX{} code) might be interested by these facts: \begin{itemize} -\item You can choose to display a dummy content explaining how to manually compile the pictures until they are compiled, see |enable fallback to manual mode|. -\item You can compile manually the images: all the commands that are left to be executed are also listed in \texttt{robExt-compile-missing-figures.sh} and you can just inspect and run them, either with \texttt{bash robExt-compile-missing-figures.sh} or by typing them manually (most of the time it's only a matter of running \texttt{pdflatex somefile.tex}). +\item You can choose to display a dummy content explaining how to manually compile the pictures instead of giving an error until they are compiled, see |enable fallback to manual mode|. +\item You can compile manually the images: all the commands that are left to be executed are also listed in \texttt{JOBNAME-robExt-compile-missing-figures.sh} and you can just inspect and run them, either with \texttt{bash robExt-compile-missing-figures.sh} or by typing them manually (most of the time it's only a matter of running \texttt{pdflatex somefile.tex} from the \texttt{robustExternalize} folder). \item If you allowed: \begin{itemize} \item |pdflatex| (needed to compile latex documents) @@ -396,11 +431,29 @@ Since we need to compile the images via an external command, the simpler option \paragraph{Is it working on overleaf?} -Yes: overleaf automatically compiles documents with |-shell-escape|, so nothing special needs to be done there (of course, if you use this library to run some code, the programming language might not be available, but I heard that python is installed on overleaf servers for instance, even if this needs to be doubled checked). If the first compilation of the document to cache images times out, you can just repeat this operation multiple times until all images are cached. +Yes: overleaf automatically compiles documents with |-shell-escape|, so nothing special needs to be done there (of course, if you use this library to run some code, the programming language might not be available, but I heard that python is installed on overleaf servers for instance, even if this needs to be doubled checked). If the first compilation of the document to cache images times out, you can just repeat this operation multiple times until all images are cached. In case of doubt, you can look at the log file to see which file is getting cached. If overleaf still times out, read the next paragraph. + +\paragraph{Overleaf still times-out, why?} + +During the first compilation, the pictures are not compiled, so you may obtain a time out. However, at each compilation, new pictures should be added to the cache, so you should eventually be able to compile (check the log file, you should read ``No need to recompile XX.pdf'' if the picture is already in the cache). If you want this to be faster, you can try to enable |\robExtConfigure{compile in parallel}| in order to compile the pictures in parallel (need 2 compilations). If you do not often change all pictures, you can also locally download the project (it might be more practical to use the git bridge if you have it enabled), compile them locally, and copy back the |robustExternalize| folder containing all cached pictures. + +If all pictures are still compiled, but you still experience timeouts, you can try to use compiled presets, with something like: +\begin{verbatim} +\robExtConfigure{ + new compiled preset={compiled ZX}{templateZX, compile latex template}{} +} +\end{verbatim} +to create a new, more efficient (we call it compiled) preset called |compiled ZX| from a preset |templateZX|. + +You can also try to reduce the compilation time by reducing the number of compilation passes. Indeed, overleaf will run |pdflatex| multiple times to make it converge to the final version, increasing mechanically the compilation time (for instance a file that takes 6s to compile locally was not able to compile online). You can force overleaf to compile a single time the document by creating a |latexmkrc| file at the root of the project, containing: +\begin{verbatim} +$max_repeat=1 +\end{verbatim} +Of course, you might need to recompile more than once the document to reach the final version. \paragraph{Do you have some benchmarks?} -We completely rewrote the \href{https://github.com/leo-colisson/robust-externalize/commit/09a05a86ec9c04eb6687b75831ebb84185786ac5}{original library} to introduce the notion of placeholders (before, the template was fixed forever), allowing for greater flexibility. The original rewrite (1.0) had really poor performance compared to the original library (only x3 improvement compared to no externalization, while the old library could be 20x faster), but we made some changes (v2.0) that correct this issue. Here is a benchmark we made on an article with 159 small pictures (ZX diagrams from the zx-calculus library): +We completely rewrote the \href{https://github.com/leo-colisson/robust-externalize/commit/09a05a86ec9c04eb6687b75831ebb84185786ac5}{original library} to introduce the notion of placeholders (before, the template was fixed forever), allowing for greater flexibility. The original rewrite (1.0) had really poor performance compared to the original library (only x3 improvement compared to no externalization, while the old library could be 20x faster), but we made some changes (v2.0) that correct this issue to recover the original speed (at least when using compiled templates). Here is a benchmark we made on an article with 159 small pictures (ZX diagrams from the zx-calculus library): \begin{itemize} \item without externalization: 1mn25 \item with externalization, v2.0 (first run, not in parallel): 3mn05, so takes twice the time; but (first run in parallel) takes 60s (so faster by a factor of 1.5). @@ -453,6 +506,45 @@ Cons of \url{https://github.com/sasozivanovic/memoize}: Note that |remember picture| is not supported in both libraries, but we can provide multiple methods to disable externalizations when |remember picture| is used. +\subsection{How to use with arXiv}\label{sec:arxiv} + +You can completely use this library with the arXiv's website (this documentation is also compiled in arXiv), but you need to follow a few steps due to arXiv's particularities: +\begin{itemize} +\item First, arXiv does NOT allow |-shell-escape|. So you either need to disable externalization (not recommended since this will of course increase the compilation time and will not work when working with non-latex code like python or external images), or you need to compile locally the document to cache all images locally\footnote{Make sure to recompile from scratch, by removing the .aux file, if your cached pictures can depend on counters (like the current page) that can change across compilations.}, and upload the |robustExternalize/| folder containing all cached images online in a zip file. +\item Moreover, if you choose to upload the |robustExternalize/| folder, the arXiv website will automatically remove all |.pdf| files if a |.tex| file is present (which will break this library, since it puts all sources in the |.tex| file and the output in a |.pdf| file). The trick is to rename all the source |.tex| files into |.tex-backup| (this library will automatically recreate the |.tex| from the |.tex-backup| starting from v2.4). We provide two approaches for that: + \begin{itemize} + \item \textbf{Solution 1}: if you have python installed the most robust solution is to run +\begin{verbatim} +$ python robExt-prepare-for-arxiv.py +\end{verbatim} + before sending the document to the arXiv. This will rename all the |.tex| files in the |robust-externalize| folder that have a matching |*.pdf| file into |.tex-backup|, and list these files in |robExt-arxiv-files-to-rename.txt|. Then, add in the preamble of your document: + \begin{codeexample}[code only] + \robExtConfigure{ + rename backup files for arxiv, + } + \end{codeexample} + This will automatically rename back the |.tex-backup| files into |.tex| (without needing shell-escape), based on the |robExt-arxiv-files-to-rename.txt| file (if this file exists and if the files have not already been renamed: it is therefore safe to keep this option on even without running the python code), allowing the rest of the document to compile normally. + \item \textbf{Solution 2}: if you do \textbf{not} have python installed, you can simply run: + \begin{codeexample}[code only] + \robExtConfigure{ + backup source for arxiv, + } + \end{codeexample} + This will automatically rename the source files |.tex| into |.tex-backup| (make sure to comment this line on the final pdf sent to the arXiv). Note however that this is less robust than solution 1 since the |.tex-backup| will be renamed into |.tex| only if it is in the source, but sometimes other |.tex| files might need to be renamed as well: for instance, |gnuplot| with |cairolatex| terminal creates two files |-gnuplot-.tex| and |-gnuplot-.pdf|, and this file will not be renamed with this method, so the |-gnuplot-.pdf| file will be lost. + \end{itemize} +\item This should be enough to compile most documents. But note that since the arXiv uses a different Texlive version and might try to compile other document formats, it might be the case that the number of page varies from your original document: if you uses things like |forward counter=page|, it might cause you some troubles since your local cache might contain the cache for |page=42| while the arXiv would ask for the cached value for |page=45|, producing an error like |enable -shell-escape|. There are a few steps you can follow to fix these issues: + \begin{itemize} + \item First, make sure to have the same margins/paper on your local file and online (by default arXiv will create a document in |letterpaper|). To that end, you can force the paper format with |\documentclass[a4paper]{article}|. + \item ArXiv might try to compile with various output formats like eps, so it might help to force a pdf output by starting your document with |\pdfoutput=1| (not sure how helpful this is, it might already be forced when we insert a pdf?). + \item ArXiv will automatically remove all empty files. While for some files it is not an issue (aux files and compilation logs), if this file is the |.pdf| it will be an issue. So make sure to always generate non-empty output files. + \item If despite these options, arXiv still tries to fetch a cached value that is not present in your local cache, you can enable +\begin{verbatim} +\robExtConfigure{print source when saving} +\end{verbatim} + This will print in the log file the content of the |.deps| file, of the |.tex| file, and the compilation command that would have been run without the error. You can then recreate these files in the cache and compile it locally. If you do not want to copy/paste the content of the file, it might be simpler to simply see the value that differs from your own local cache and just temporarily change this value in your local document to automatically generate the correct cache entry. If the value is obtained via |forward counter=page|, you can use |forward counter force value={page}{45}| to force the value of the counter. + \end{itemize} +\end{itemize} + \section{Tutorial} \subsection{Installation} @@ -473,7 +565,7 @@ If you want to display a message in the pdf on how to manually compile the file \noindent (otherwise, it will give you an error if |-shell-escape| is disabled and if some pictures are not yet cached) -If you forget/do not want to enable |-shell-escape|, this will give you this kind of message: +If you forget/do not want to enable |-shell-escape|, this will give you this kind of message with instructions to follow to compile without shell escape: \noindent { \robExtConfigure{ @@ -486,6 +578,32 @@ If you forget/do not want to enable |-shell-escape|, this will give you this kin } +If you use an editor, you can usually configure |-shell-escape| directly inside the editor, even on a per-document basis. Shell-escape is enabled by default on overleaf. In emacs/auctex, just add at the end of your document: +\begin{verbatim} +% Local Variables: +% TeX-command-extra-options: "--shell-escape" +% End: +\end{verbatim} +save, and run |M-x revert-buffer| (Note that it seems that |--shell-escape| can be used with one or two dashes on Linux, I am not sure about the number of dashes needed in Windows.) + +For TeXstudio, you can enable shell-escape on the current document by adding in your document: +\begin{verbatim} +% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape] +\end{verbatim} +and you might also want to enable: +\begin{verbatim} +\robExtConfigure{textstudio} +\end{verbatim} +to get clearer error messages as TeXstudio is \mylink{https://github.com/texstudio-org/texstudio/issues/1410}{fairly bad at parsing error messages} (see also |print whole file in error message|). + +If you use |latexmk| (with any editor), you can create a file called |.latexmkrc| containing: +\begin{verbatim} +$pdf_mode = 1; +$pdflatex = 'pdflatex --shell-escape'; +\end{verbatim} + +For other editors, \mylink{https://tex.stackexchange.com/questions/598818/how-can-i-enable-shell-escape}{this answer} describe pretty accurately the solutions you have depending on your software. + \subsection{Caching a tikz picture} If you only care about \tikzname's picture, you have 3 options: @@ -610,11 +728,48 @@ Note that if you use the |tikzpictureC| or |tikzpicture| syntax, you want to add \textbf{Important}: Note that the preset options can be specified in a number of places: in |\robExtConfigure| (possibly in a group, or inside a preset), in the options of the picture, in the default options of |cacheEnvironment| and |cacheCommand| etc. Most options can be used in all these places, the only difference being the scope of the options. +If you find yourself duplicating code between the main document and the preamble of the cached file, we provide multiple solutions with different properties: +\begin{itemize} +\item Recommended: |\newcommandAutoForward| etc, to automatically forward specific macros/colors etc: see \cref{sec:forwardIntro}. Very useful if you want maximum purity without annoying recompilation. +\item |\runHereAndInPreambleOfCachedFiles|: mostly useful if you want to always add a text both in the current file and in the cached files, like a font etc. +\item Share a common input file with or without dependencies (see \cref{sec:dependencies}), useful if you need to work with external files or if you do NOT want purity (i.e.\ you can choose not to recompile the file even if its content changes). +\end{itemize} + +|\runHereAndInPreambleOfCachedFiles{XXX}| is very simple (need at least version 2.3), as it is simply a shortcut for typing |XXX| in the current file and in the preamble of the cached files (default to latex preset). For instance if you want the current file and all cached files to use the Times New Roman font, you can do: + +\begin{codeexample}[code only] +% By default adds +\runHereAndInPreambleOfCachedFiles{ + \usepackage{fontspec} + % need lualatex or xelatex to compile + \setmainfont{Times New Roman} +} + +\robExtConfigure{ + add to preset={latex}{ + use lualatex, % Make sure to compile with lualatex the cached images. + }, +} +\end{codeexample} + +You can also define your common macros (even if we recommend |\newcommandAutoForward| to avoid frequent recompilations when the definitions changes): +\begin{codeexample}[width=0pt,vbox] +\runHereAndInPreambleOfCachedFiles{ + \def\name#1{The great lady #1 and her friends.} +} + +\cacheTikz +This is the picture of \name{Alice}: +\begin{tikzpicture} + \node[fill=orange]{\name{Alice}}; +\end{tikzpicture} +\end{codeexample} + \subsection{Dependencies}\label{sec:dependencies} -\textbf{Note: dependencies can sometimes be advantageously replaced with auto-forwarding of arguments, cf.\ \cref{sec:forwardIntro}.} +\textbf{Note: dependencies can sometimes be advantageously replaced with auto-forwarding of arguments, cf.\ \cref{sec:forwardIntro}, or |\runHereAndInPreambleOfCachedFiles|.} -It might be handy to have a file that is loaded in both the main document and in the cached pictures. For instance, if you have a file |common_inputs.tex| that you want to input in both the main file and in the cached files, that contains, say:\\ +It might be handy to have a file that is loaded in both the main document and in the cached pictures. For instance, if you have a logo that might be included in the cached files, or if you have a file |common_inputs.tex| that you want to input in both the main file and in the cached files, that contains, say:\\ |\def\myValueDefinedInCommonInputs{42}|\\ then you can add it as a dependency this way (here we use the |latex| preset that does not wrap the code inside a |tikzpicture| only to illustrate that we can also cache things that are not generated by tikz): \begin{codeexample}[width=0pt,vbox] @@ -628,6 +783,13 @@ Note that the placeholder |__ROBEXT_WAY_BACK__| contains the path from the cache You can note that we used |add dependencies={common_inputs.tex}|: this allows us to recompile the files if |common_inputs.tex| changes. If you do not want this behavior (e.g. |common_inputs.tex| changes too often and you do not want to recompile everything at every change), you can remove this line, but beware: if you do a breaking changes in |common_inputs.tex| (e.g.\ redefine |42| to |43|), then the previously cached picture will not be recompiled! (So you will still read 42 instead of 43.) +Sometimes, it can also be useful to copy a file in the cache folder. This can be done via: +\begin{codeexample}[code only] +\robExtConfigure{ + copy file to cache={zx-calculus.sty}, +} +\end{codeexample} + \subsection{Wrap arbitrary environments} You can wrap arbitrary environments using the already presented |cacheEnvironment| and |cacheCommand|, where the first mandatory argument is the name of the environment/macro, and the second mandatory argument contains the default preset. |cacheEnvironment| works for any environment while |cacheCommand| might need a bit of help to determine the signature of the macro if the function is defined via xparse. Long story short, |O{foo}| is an optional argument with default value foo, |m| is a mandatory argument. By default, you can pass an optional arguments via the first argument enclosed in |<>|: @@ -725,6 +887,7 @@ Some text % You can feed data from the main document to the cached file using placeholders, since |set placeholder eval={__foo__}{\bar}| will evaluate |\bar| and put the result in |__foo__|. For instance, if the picture depends on the current page, you can do: +\message{We will export the page: \thepage} \begin{codeexample}[width=0pt,vbox] \begin{tikzpictureC}<set placeholder eval={__thepage__}{\thepage}> \node[rounded corners, fill=red]{The current page is __thepage__.}; @@ -820,6 +983,105 @@ We compute this data that is long to compute: We computed the cached value \myLongResult. \end{codeexample} +\subsection{A note on font handling} + +Cached pictures are basically simple latex files that are compiled in a separate |standalone| document. Therefore, if the main document loads a different font, there is no reason for the cached document to also use that font. Fully-automatically forwarding the current font by default is not so easy because there are so many ways to load a font in LaTeX (by loading a package like |\usepackage{times}|, by using xelatex or lualatex, by calling locally |\rmfamily|, by loading a different class… and here I'm not even mentioning math font where each symbol \mylink{https://tex.stackexchange.com/questions/603475/is-there-any-command-to-find-out-the-current-math-font-used)}{can use a different font}, and this is even more complicated if the main file is compiled with a different engine (e.g.\ what should I do if the main document is compiled with lualatex but the inner cached images are compiled with pdflatex, that supports very few fonts by default?). For these reasons, it is simpler to simply let the user load fonts as they want, for instance using something like: +\begin{codeexample}[width=0pt] +\robExtConfigure{ + add to preset={latex}{ + add to preamble={\usepackage{times}}, + }, +} + +\begin{tikzpictureC} +\node[fill=green]{See I am using times font}; +\end{tikzpictureC} +\end{codeexample} +or: +\begin{codeexample}[width=0pt] +\robExtConfigure{ + add to preset={latex}{ + add to latex options={12pt}, + }, +} + +\begin{tikzpictureC} +\node[fill=green]{See I am using a 12pt font}; +\end{tikzpictureC} +\end{codeexample} + +But if you want to use the same font as the current document, you might want to avoid code duplication (this might also be useful for any arbitrary code). Since v2.3, you can do: +\begin{codeexample}[code only] +\runHereAndInPreambleOfCachedFiles{ + \usepackage{fontspec} + % need lualatex or xelatex to compile + \setmainfont{Times New Roman} +} + +\robExtConfigure{ + add to preset={latex}{ + use lualatex, % Make sure to compile with lualatex the cached images. + }, +} +\end{codeexample} +and it will automatically compile the cached images with lualatex, and configure the font of the current document and of the cached documents to follow |Times New Roman|. + +If you like to often change the font in the document, you can also do something like that to always compile the document with the font currently in use if you use lualatex (this code fails with \mylink{https://tex.stackexchange.com/questions/705208/get-current-font}{xelatex}, currently trying to understand why): +\begin{codeexample}[code only] +\usepackage{fontspec} +\setmainfont{Times New Roman} + +%% needed since \f@family contains a @ in its name: +\makeatletter +\def\myCurrentFont{\f@family} +\makeatother + +\robExtConfigure{ + add to preset={latex}{ + use lualatex, + % create a new placeholder containing the name of the current font: + set placeholder eval={__MY_FONT__}{\myCurrentFont}, + add to preamble={ + \usepackage{fontspec} + \setmainfont{__MY_FONT__} + }, + }, +} +\end{codeexample} +If you want this to work on xelatex, you can either manually attribute a |NFSSFamily| name like: +\begin{codeexample}[code only] +\runHereAndInPreambleOfCachedFiles{ + \usepackage{fontspec} + % need lualatex or xelatex to compile, make sure to use a different NFSSFamily for each new font you add here + \setmainfont[NFSSFamily=tmsnr]{Times New Roman} +} +\end{codeexample} +and use the above solution for lualatex (you can change the font with |\fontfamily{tmsnr}\selectfont|), or do instead something like this: +\begin{codeexample}[code only] +% Create a new command \mysetmainfont which forwards the font to the picture. +\NewDocumentCommand{\mysetmainfont}{m}{% + \def\myCurrentFont{#1}% Stores the name of the current font in \myCurrentFont + \setmainfont{#1}% +} + +% Use mysetmainfont from now to change font: +\mysetmainfont{Times New Roman} + +\usepackage{robust-externalize} +\robExtConfigure{ + add to preset={latex}{ + use xelatex, + set placeholder eval={__MY_FONT__}{\myCurrentFont}, + add to preamble={ + \usepackage{fontspec} + \setmainfont{__MY_FONT__} + }, + }, +} +\end{codeexample} + + + \subsection{Compile in parallel} Make sure to have xargs installed (installed by default on most linux, on Windows you need to install the lightweight GNU On Windows (Gow) \url{https://github.com/bmatzelle/gow}), and type in your preamble: \begin{codeexample}[code only] @@ -1162,7 +1424,8 @@ We also provide support for other languages, notably |bash|, but it is relativel set -e __ROBEXT_MAIN_CONTENT__ # Create the pdf file to certify that no compilation error occured -touch "__ROBEXT_OUTPUT_PDF__" +# (non empty file to avoid arXiv error) +echo "ok" > "__ROBEXT_OUTPUT_PDF__" \end{PlaceholderFromCode} \robExtConfigure{ @@ -1216,7 +1479,9 @@ plt.savefig("__ROBEXT_OUTPUT_PDF__") If you want to recompile a file (e.g. an untracked dependency was changed\dots{} and you do not want to track it to avoid recompilation when you change a single line in this file), you can use the |recompile| style since v2.1: -\begin{codeexample}[vbox] +\begin{codeexample}[vbox, + %TURN_INTO_CODE_ONLY_ARXIV + ] \cacheEnvironment{tikzcd}{tikz, add to preamble={\usepackage{tikz-cd}}} \begin{tikzcd}<recompile> A \rar & B @@ -1248,7 +1513,7 @@ Note also that we usually define two names for each function, one normal and one \subsection{Placeholders}\label{sec:placeholders} -Placeholders are the main concept allowing this library to generate the content of a source file based on a template (a template will itself be a placeholder containing other placeholders). A placeholder is a special strings like |__COLOR_IMAGE__| that should start and end with two underscores, ideally containing no space or double underscores inside the name directly. Placeholders are inserted for instance in a string and will be given a value later. This value will be used to replace (recursively) the placeholder in the template. For instance, if a placeholder |__LIKES__| contains |I like __FRUIT__ and __VEGETABLE__|, if the placeholder |__FRUIT__| contains |oranges| and if the placeholder |__VEGETABLE__| contains |salad|, then evaluating |__LIKES__| will output |I like oranges and salad.| +Placeholders are the main concept allowing this library to generate the content of a source file based on a template (a template will itself be a placeholder containing other placeholders). A placeholder is a special strings like |__COLOR_IMAGE__| that should start and end with two underscores, ideally containing no space or double underscores inside the name directly (we might use this property even more in a future release to improve further the efficiency). Placeholders are inserted for instance in a string and will be given a value later. This value will be used to replace (recursively) the placeholder in the template. For instance, if a placeholder |__LIKES__| contains |I like __FRUIT__ and __VEGETABLE__|, if the placeholder |__FRUIT__| contains |oranges| and if the placeholder |__VEGETABLE__| contains |salad|, then evaluating |__LIKES__| will output |I like oranges and salad.| Note that you are not strictly forced to follow the above convention (it allows us to optimize the code to find and replace placeholders), but in that case you should enable |not all placeholders have underscores|. @@ -1405,6 +1670,18 @@ Compare with: \placeholderFromContent{__NAME__}{Alice} The (unexpanded) template contains \texttt{\getPlaceholderNoReplacement{__LIKES__}} \end{codeexample} +Note that this macro is expandable, which can be helpful for instance if you use |siunitx| that expects an expandable content: +\begin{codeexample}[width=0pt,vbox] +\setPlaceholder{__TEST__}{4.42345} +\num[round-mode=figures,round-precision=3]{\getPlaceholderNoReplacement{__TEST__}} +\end{codeexample} +This is contrary to |\getPlaceholder| that is not expandable, so if you do want expandable |\getPlaceholder| with replacements, you should rather first evaluate the placeholder with |\getPlaceholderInResult{__TEST_VARIABLE__}|: +\begin{codeexample}[width=0pt,vbox] +\setPlaceholder{__TEST_A__}{4.42345} +\setPlaceholder{__TEST__}{__TEST_A__} +\getPlaceholderInResult{__TEST_A__} +\num[round-mode=figures,round-precision=3]{\robExtResult} +\end{codeexample} \end{pgfmanualentry} \subsubsection{Setting a value to a placeholder} @@ -2297,9 +2574,16 @@ plt.ylabel('Number of futurestud.io Tutorials') \makeatletter% \def\extrakeytext{style, } \extractkey/robExt/set compilation command=\marg{compilation command}\@nil + \extractkey/robExt/set compilation command create if no error=\marg{compilation command}\@nil + \extractkey/robExt/set compilation command move if no error=\marg{compilation command}\@nil \makeatother% \pgfmanualbody - Style that alias to |set placeholder={__ROBEXT_COMPILATION_COMMAND__}{#1}|, in order to define the placeholder that will hold the compilation command. + |set compilation command| is equivalent to |set placeholder={__ROBEXT_COMPILATION_COMMAND__}{#1}|, in order to define the placeholder that will hold the compilation command. + + Then, |set compilation command move if no error| (new in v2.4) + is like |set compilation command| except that it will copy the file located in |__ROBEXT_OUTPUT_PDF__-tmp| into |__ROBEXT_OUTPUT_PDF__| if the command succeeds (returns a status code of 0), and otherwise it will not create the |__ROBEXT_OUTPUT_PDF__| at all, creating an error message. This is needed by some programs that will create an output file even if an error occurs, for instance wget will still create an empty file if there is no internet connection, producing no error during the compilation, which can be confusing. + + |set compilation command create if no error| (new in v2.4) will, on the other hand, create an empty |__ROBEXT_OUTPUT_PDF__| file if the command succeeds (only useful if you use a custom include command). \end{pgfmanualentry} \begin{pgfmanualentry} @@ -2353,7 +2637,9 @@ plt.ylabel('Number of futurestud.io Tutorials') \pgfmanualbody (new to v2.1) |recompile| will force a compilation even if the image is already cached (mostly useful if you made a change to a non-tracked dependency). Note that since this library does not want to remove any file on the hard drive (we do not want to risk to remove important files in case of a bug), this command will NOT clear the auxiliary files already present, so for maximum purity, ensure that your compiling command is idempotent (so that compiling twice gives the same outcome as compiling once). -\begin{codeexample}[vbox] +\begin{codeexample}[vbox, + %TURN_INTO_CODE_ONLY_ARXIV + ] \cacheEnvironment{tikzcd}{tikz, add to preamble={\usepackage{tikz-cd}}} \begin{tikzcd}<recompile> A \rar & B @@ -2393,6 +2679,15 @@ You want to delete the file \texttt{\filetodeleteInCache.pdf}. % \end{pgfmanualentry} +\begin{pgfmanualentry} + \extractcommand\robExtMv\@@ + \extractcommand\robExtCp\@@ + \pgfmanualbody + (new in v2.4) Respectively expands to |mv| and |cp| in linux/unix and to |move| and |copy| in Windows (needed to create a compilation command that works in both linux and windows). Note that |set compilation command| does NOT expand its argument by default and spaces after macros are removed by latex, so you need to use |/.expanded| and |\space| like in: + \begin{codeexample}[code only] + set compilation command/.expanded={\robExtCp\space"__ROBEXT_SOURCE_FILE__" "__ROBEXT_OUTPUT_PDF__"} + \end{codeexample} +\end{pgfmanualentry} \subsubsection{Options to configure the inclusion command} @@ -2413,19 +2708,26 @@ The inclusion command is the command that is run to include the cached file back \makeatletter% \def\extrakeytext{style, } \extractkey/robExt/custom include command=\marg{include command}\@nil + \extractkey/robExt/include command is input=\opt{\oarg{additional code to run}}\@nil \makeatother% \pgfmanualbody - Sets the command to run to include the compiled file, after checking if the file has been correctly compiled and loading |*-out.tex| (useful to pass information back to the pdf). + Sets the command to run to include the compiled file, after checking if the file has been correctly compiled and loading |*-out.tex| (useful to pass information back to the pdf). |include command is input={SOME CODE}| is a shortcut for: +\begin{verbatim} +custom include command={SOME CODE\input{\robExtAddCachePathAndName{\robExtFinalHash.pdf}}}, +\end{verbatim} \end{pgfmanualentry} \begin{pgfmanualentry} \makeatletter% \def\extrakeytext{style, } \extractkey/robExt/do not include pdf\@nil + \extractkey/robExt/include command is input=\opt{additional command}\@nil \makeatother% \pgfmanualbody - Do not include the pdf. Useful if you only want to compile the file but use it later (note that you should still generate a |.pdf| file, possibly empty, to indicate that the compilation runs smootly). Equivalent to:\\ + |do not include pdf| do not include the pdf. Useful if you only want to compile the file but use it later (note that you should still generate a |.pdf| file, possibly empty, to indicate that the compilation runs smootly). Equivalent to:\\ |custom include command={}| + Use |include command is input| (v2.3 and after) in order to specify that you should |\input| the |.pdf| file (note that despite the extension, it should still contain a LaTeX code). You can also specify an optional command to run before. Equivalent to: + |custom include command={#1\input{\robExtAddCachePathAndName{\robExtFinalHash.pdf}}}| \end{pgfmanualentry} \begin{pgfmanualentry} @@ -2465,6 +2767,16 @@ The inclusion command is the command that is run to include the cached file back By default, the include commands runs |\includegraphics| on the pdf, and possibly raises it if needed. You can customize the arguments passed to |\includegraphics| here. \end{pgfmanualentry} +\begin{pgfmanualentry} + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/add cache to graphicspath\@nil + \makeatother% + \pgfmanualbody + This will add the folder containing the cache in the |\graphicspath{}|. Mostly useful if you need to input a file from the cache that does |\includegraphics{foo}| where |foo| is an image from the cache itself (looking at you gnuplot). +\end{pgfmanualentry} + + \subsubsection{Configuration of the cache} If needed, you can configure the cache: @@ -2497,6 +2809,24 @@ If needed, you can configure the cache: \begin{pgfmanualentry} \makeatletter% \def\extrakeytext{style, } + \extractkey/robExt/set output directory=\marg{output directory}\@nil + \makeatother% + \pgfmanualbody + If you compile with |--output-directory build|, you also need to tell this library that you are compiling with |--output-directory build|. As I can't find a reliable way to get this value, even using |TEXMF_OUTPUT_DIRECTORY|, you need to specify manually the compilation directory. To do that, you can either compile with: + \begin{codeexample}[code only] + pdflatex -shell-escape -output-directory=build "\def\robExtOutputDirectory{build}\input{test.tex}" + \end{codeexample} + or add in your file: + \begin{codeexample}[code only] + \robExtConfigure{ + set output directory=build, + } + \end{codeexample} +\end{pgfmanualentry} + +\begin{pgfmanualentry} + \makeatletter% + \def\extrakeytext{style, } \extractkey/robExt/no cache folder\@nil \makeatother% \pgfmanualbody @@ -2580,6 +2910,7 @@ Some text % \def\extrakeytext{style, } \extractkey/robExt/command if no externalization\@nil \extractkey/robExt/command if externalization\@nil + \extractkey/robExt/run command if externalization=\marg{code}\@nil \makeatother% \pgfmanualbody You can easily change the command to run if externalization is disabled using by setting the \textbf{.code} of this key. By default, it is configured as:\\ @@ -2589,7 +2920,7 @@ command if no externalization/.code={% } \end{verbatim} Unless you know what you are doing, you should include |\robExtDisableTikzpictureOverwrite| as it is often necessary to avoid infinite recursion when externalization is disabled and the original command has been replaced with a cached version (for instance done by |\cacheTikz|). Note that if you write your own style, try to modify |__ROBEXT_MAIN_CONTENT__| so that it can be included as-it in a document: this way you do not need to change this command. - You can also use |command if externalization/.append code={...}| if you want to run a code only if externalization is enabled (this is used for instance by the |forward| functionality). + You can also use |command if externalization/.append code={...}| if you want to run a code only if externalization is enabled (this is used for instance by the |forward| functionality), but we advise you rather to use |run command if externalization={...}| as this will also work if the style is executed while |command if externalization| is already running (this might occur when calling the style inside |if matches word|, for instance when forwarding colors). \end{pgfmanualentry} \begin{pgfmanualentry} @@ -2665,6 +2996,23 @@ In order to enforce reproducibility, you should tell what are the files that you Note that the placeholder |__ROBEXT_WAY_BACK__| contains the path from the cache folder (containing the |.tex| that will be cached) to the root folder.\\ This way, you can easily input files contained in the root folder. \end{pgfmanualentry} +\begin{pgfmanualentry} + \extractcommand\copyFileToCache\@@ + \extractcommand\forceCopyFileToCache\@@ + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/copy file to cache=\marg{file}\@nil + \makeatother% + \pgfmanualbody + It can sometimes be handy to copy a file to the cache folder to avoid using |__ROBEXT_WAY_BACK__| for instance to refer to another file. This can be done with |copy file to cache|, either in a preset or in |\robExtConfigure| like: +\begin{codeexample}[code only] +\robExtConfigure{ + copy file to cache={zx-calculus.sty}, +} +\end{codeexample} +Note that |copy file to cache| will always compare the md5 sum to check if a copy must be done or not. +\end{pgfmanualentry} + \subsubsection{Forward macros}\label{sec:forward} (since v2.1) @@ -2762,6 +3110,7 @@ Really involved macros (e.g.\ defined inside libraries) might call many other ma \makeatletter% \def\extrakeytext{style, } \extractkey/robExt/forward counter=counter to forward\@nil + \extractkey/robExt/forward counter force value=\marg{counter to forward}\marg{value of counter}\@nil \makeatother% \pgfmanualbody Forward a counter: @@ -2770,6 +3119,12 @@ Really involved macros (e.g.\ defined inside libraries) might call many other ma \node[rounded corners, fill=red]{The current page is \thepage.}; \end{tikzpictureC} \end{codeexample} +The force value also assigns a value to the counter irrespective of the current value (might be useful for instance to generate a cached value for the arXiv). +\begin{codeexample}[width=0pt] +\begin{tikzpictureC}<forward counter force value={page}{65}> + \node[rounded corners, fill=red]{The current page is \thepage.}; +\end{tikzpictureC} +\end{codeexample} \end{pgfmanualentry} \begin{pgfmanualentry} @@ -2794,13 +3149,25 @@ but also with colors defined with |\colorlet|: \node[fill=myviolet,yshift=-1cm]{B}; \end{tikzpictureC} \end{codeexample} -Note that using |if matches word|, you can also automatically forward colors: +Note that using |if matches word|, you can also automatically forward colors. This command also scales better than |if matches|: if |if matches| is used to register $N$ words, the compilation time will increase for each new |if matches| (since we need to check each time if the string contains the expression). |if matches word|, on the other hand, is more clever, and extracts in a single loop all the words of the string: the running time is therefore independent of the number of times |if matches word| was called. You can call |if matches word| outside of any preset like in: \begin{codeexample}[width=0pt] \definecolor{myred}{HTML}{F01122} \colorlet{myviolet}{blue!50!myred} \colorlet{mypink}{pink!90!orange} \robExtConfigure{ - add to preset={tikz}{ + if matches word={mypink}{forward color=mypink}, +} +\begin{tikzpictureC} + \node[fill=mypink,yshift=-1cm]{B}; +\end{tikzpictureC} +\end{codeexample} +And this will automatically allow all presets based on |latex| to forward this color (see also |\definecolorAutoForward| to do that even quicker). You can also simply call it on any preset of your choice like: +\begin{codeexample}[width=0pt] +\definecolor{myred}{HTML}{F01122} +\colorlet{myviolet}{blue!50!myred} +\colorlet{mypink}{pink!90!orange} +\robExtConfigure{ + add to preset={latex}{ if matches word={mypink}{forward color=mypink}, }, } @@ -2808,7 +3175,7 @@ Note that using |if matches word|, you can also automatically forward colors: \node[fill=mypink,yshift=-1cm]{B}; \end{tikzpictureC} \end{codeexample} -but since this is a bit long to type, we provide a shortcut: +or, equivalently: \begin{codeexample}[width=0pt] \definecolor{myred}{HTML}{F01122} \colorlet{myviolet}{blue!50!myred} @@ -2826,9 +3193,11 @@ but since this is a bit long to type, we provide a shortcut: \makeatletter% \def\extrakeytext{style, } \extractkey/robExt/auto forward\@nil + \extractkey/robExt/auto forward only macros\@nil + \extractkey/robExt/auto forward words\@nil \makeatother% \pgfmanualbody - Enable automatic forwarding of macros marked with |*AutoForward| commands or |\configIfMacroPresent|. This command naively extracts all used macro via a simple regex match and forwards them/execute the style configured in |\configIfMacroPresent| if it exists. + |auto forward| enables automatic forwarding of macros marked with |*AutoForward| commands or |\configIfMacroPresent| or |if matches word|. This command naively extracts all used macros via a simple regex match and forwards them/execute the style configured in |\configIfMacroPresent| if it exists. It does a similar thing for words registered via |if matches word| or |register word with namespace|. If you want to only forward macros or words, you can use |auto forward only macros| or |auto forward words|. \begin{codeexample}[vbox] \cacheTikz \robExtConfigure{add to preset={tikz}{auto forward}} @@ -2878,8 +3247,8 @@ but since this is a bit long to type, we provide a shortcut: \extractcommand\ProvideExpandableDocumentCommandAutoForward\marg{macro}\marg{arg spec}\opt{\oarg{additional style}}\marg{definition}\@@ \extractcommand\DeclareExpandableDocumentCommandAutoForward\marg{macro}\marg{arg spec}\opt{\oarg{additional style}}\marg{definition}\@@ \extractcommand\defAutoForward\marg{macro}\opt{\oarg{def-style arg spec}}\marg{macro}\opt{\oarg{additional style}}\@@ - \extractcommand\genericAutoForward\opt{*}\opt{\oarg{preset}}\marg{string to match}\opt{\oarg{additional style}}\marg{code to execute}\@@ - \extractcommand\genericAutoForwardStringMatch\opt{*}\opt{\oarg{preset}}\marg{string to match}\opt{\oarg{additional style in preset}}\opt{\oarg{additional style outside preset}}\marg{code to execute}\@@ + \extractcommand\genericAutoForward\opt{*}\opt{\oarg{preset}}\opt{\oarg{namespace}}\marg{word}\opt{\oarg{additional style}}\marg{code to run}\@@ + \extractcommand\genericAutoForwardStringMatch\opt{*}\opt{\oarg{preset}}\marg{string}\opt{\oarg{additional style}}\marg{code to run}\@@ \pgfmanualbody \begin{verbatim} \newcommandAutoForward{\macro}[nb args][default value]{def}[STYLE] @@ -2908,7 +3277,7 @@ but since this is a bit long to type, we provide a shortcut: \end{tikzpicture} \end{codeexample} - This works similarly for other commands (note that for |\defAutoForward|, you need to put the arguments in a bracket, like |\defAutoForward\myMacro[#1 and #2]{Hey #1, #2}| for |\def\myMacro#1 and #2{Hey #1, #2}|). |\genericAutoForward| and |\genericAutoForwardStringMatch| are a bit special (for now these two commands are alias, but only use the first one if the string is surrounded by non-letter characters as we plan to make that special case more efficient later as it uses internally |if matches word|), as it can be used to run any code assuming that |string to match| is present. For instance, you can use it to automatically forward the code that defines a new tikz style assuming |mystyle| is preset: + This works similarly for other commands (note that for |\defAutoForward|, you need to put the arguments in a bracket, like |\defAutoForward\myMacro[#1 and #2]{Hey #1, #2}| for |\def\myMacro#1 and #2{Hey #1, #2}|). |\genericAutoForward| and |\genericAutoForwardStringMatch| are a bit special, as it can be used to run any code assuming that |word|/|string to match| is present (|\genericAutoForward| is more efficient as it does not scale with the number of words, but do not allow spaces etc in the name). For instance, you can use it to automatically forward the code that defines a new tikz style assuming |mystyle| is preset: \begin{codeexample}[width=0pt] \cacheTikz \genericAutoForward{mystyle}{ @@ -2943,6 +3312,68 @@ This will also run the code to define it in the current document (practical for }; \end{tikzpicture} \end{codeexample} + \begin{codeexample}[vbox] + % space is not allowed in the name with this more efficient version: + \robExtGenericAutoForward{mystyle}{% + \tikzset{% + mystyle/.style={fill=#1!30!white,text=#1!40!black}, + }% + } + \begin{tikzpictureC} + \node[mystyle=green]{My style automatically forwarded}; + \end{tikzpictureC} + \end{codeexample} + \begin{codeexample}[vbox] + % space is allowed in the name with this slightly less efficient version: + \robExtGenericAutoForwardStringMatch{my style}{% + \tikzset{% + my style/.style={fill=#1!30!white,text=#1!40!black}, + }% + } + \begin{tikzpictureC} + \node[my style=green]{My style with a space in the name automatically forwarded}; + \end{tikzpictureC} + \end{codeexample} + Note that by default, this forwards elements in the |latex| preset, but you can change it via |preset|. You can also configure additional style to run, and choose another namespace for the word version (practical only if you want to forward different codes to different presets: note that a single namespace is allowed per preset). +\end{pgfmanualentry} + +\begin{pgfmanualentry} + \extractcommand\runHereAndInPreambleOfCachedFiles\opt{\oarg{preset}}\marg{code}\@@ + \pgfmanualbody + (from v2.3) This will run |code| right now and it will add it in the preamble of the files that use the preset |preset| (defaults to |latex|). This is practical to avoid duplicating the code into |add to preamble|. For instance, if want the configure the font of the current document and of all latex documents at the same time, use: +\begin{codeexample}[code only] +\runHereAndInPreambleOfCachedFiles{ + \usepackage{fontspec} + \setmainfont{Times New Roman} +} + +\robExtConfigure{ + add to preset={latex}{ + use lualatex, % Make sure to compile with lualatex the cached images. + }, +} +\end{codeexample} +\end{pgfmanualentry} + +\begin{pgfmanualentry} + \extractcommand\definecolorAutoForward\marg{color}\marg{model}\marg{value}\opt{\oarg{additional style}}\@@ + \extractcommand\colorletAutoForward\marg{color}\marg{value}\opt{\oarg{additional style}}\@@ + \pgfmanualbody + Define colors like |\definecolor| and |\colorlet|, but also runs +\begin{verbatim} +if matches word={COLOR}{forward color=COLOR} +\end{verbatim} + to automatically forward the color (this will forward it only in latex-based presets). You can provide additional style to run as well in option. + \begin{codeexample}[vbox] + \definecolorAutoForward{myred}{HTML}{F01122} + \colorletAutoForward{myviolet}{blue!50!myred} + \begin{tikzpictureC} + \node[fill=myred,yshift=-1cm]{Uses myred}; + \end{tikzpictureC} + \begin{tikzpictureC} + \node[fill=myviolet,yshift=-1cm]{Myviolet}; + \end{tikzpictureC} + \end{codeexample} \end{pgfmanualentry} \begin{pgfmanualentry} @@ -2974,9 +3405,12 @@ This will also run the code to define it in the current document (practical for \extractkey/robExt/if matches=\marg{string}\marg{style to apply}\@nil \extractkey/robExt/if matches word=\marg{string}\marg{style to apply}\@nil \extractkey/robExt/if matches regex=\marg{latex3 regex}\marg{style to apply}\@nil + \extractkey/robExt/register word with namespace=\marg{namespace}\marg{word}\marg{style}\@nil + \extractkey/robExt/auto forward words\@nil + \extractkey/robExt/auto forward words namespace=\marg{namespace}\@nil \makeatother% \pgfmanualbody - Apply the corresponding style if the string (resp.\ regex in \LaTeX{}3 format) matches is matched in the content. As of today, |if matches word| and |if matches| are equivalent, but I plan to make |if watches word| more efficient\footnote{Scaling with $O(s)$ instead of $O(sn)$, where $s$ is the size of the string typed in |cacheMe| and $n$ is the number of times |if matches| is used, for instance when replacing multiple strings.}, and make it only match words that are made of consecutive letters |[A-Za-z]|. The regex version can be more expressive, but is significantly slower (it can easily multiply by 2 the compilation time). + |if matches *| applies the corresponding style if the string (resp.\ word or regex in \LaTeX{}3 format) matches is matched in the content. |if matches word| is more efficient that |if matches string| since the running time is independent of the number of times |if matches word| is called\footnote{Scaling with $O(s)$ instead of $O(sn)$, where $s$ is the size of the string typed in |cacheMe| and $n$ is the number of times |if matches| is used, for instance when replacing multiple strings.}. |if matches word| make it only match words that are mostly made of consecutive letters and numbers |[A-Za-z0-9]| (more precisely separated by elements in |\robExtWordSeparators|). The regex version can be more expressive, but is significantly slower (it can easily multiply by 2 the compilation time). \begin{codeexample}[vbox] \robExtConfigure{ add to preset={my python}{ @@ -3021,8 +3455,10 @@ Some text % \draw[->] (0,0) to[bend left] (my original node); \end{tikzpicture} \end{codeexample} +Note that to make |if matches word| even more efficient, you can call it before the preset. It will "register" the corresponding word with |register word| (itself a shortcut for |register word with namespace| with an empty namespace), and call |auto forward words| (shortcut for |auto forward words namespace={}|) in the |latex| preset (or in the current preset if we are already in a preset) to forward all words registered in the corresponding namespace (empty by default). Unless you want to forward different words to different presets, these more advanced functions involving namespaces should not be really useful for the end user. \end{pgfmanualentry} + \subsubsection{Pass compiled file to another template}\label{sec:passOutputToOtherTemplate} It can sometimes be handy to use the result of a previous cached file to cache another file, or to do anything else (e.g.\ it can also be practical to debug an issue). |name output| can be used to do that @@ -3490,7 +3926,7 @@ outputTxt="__ROBEXT_OUTPUT_PREFIX__-out.txt" outputTex="__ROBEXT_OUTPUT_PREFIX__-out.tex" outputPdf="__ROBEXT_OUTPUT_PDF__" \end{verbatim} -in order to quit when an error occurs, and to define two variables containing the path to the |pdf| file and to the file that is read by the |verbatim output| setting (that just apply a |\verbatiminput| on that file). Finally, it also creates the file |outputPdf| with |touch| in order to notify that the compilation succeeded. +in order to quit when an error occurs, and to define two variables containing the path to the |pdf| file and to the file that is read by the |verbatim output| setting (that just apply a |\verbatiminput| on that file). Finally, it also creates the file |outputPdf| with |echo "ok"| in order to notify that the compilation succeeded. In practice: \begin{codeAndResult} @@ -3530,6 +3966,230 @@ This file contains: You might also like to use |name output=yourfile| that will create two macros |\yourfile| and |\yourfileInCache|, equal respectively to the prefix |robExt-somehash| and |pathOfCache/robExt-somehash|. +\subsubsection{Online images} + +We also provide support for online images since v2.3. +\begin{pgfmanualentry} + \extractcommand\includegraphicsWeb\opt{<robExt options>}\opt{\oarg{includegraphics options}}\marg{url image}\@@ + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/web image\@nil + \extractkey/robExt/web image/wget\@nil + \extractkey/robExt/web image/curl\@nil + \makeatother% + \pgfmanualbody + |\includegraphicsWeb| is used in place of |\includegraphics| to download online images: +\begin{codeexample}[width=0pt,vbox] +Here is a cat downloaded online: \includegraphicsWeb[width=3cm]{http://placekitten.com/400/300}. +\end{codeexample} +By default, the engine uses |wget| in linux (since it is installed by default) and |curl| on windows (should also be installed by default on recent windows). But you can change it by modifying the |web image| preset (or using the optional robExt options that are loaded after |web image|): +\begin{codeexample}[width=0pt,vbox] +\robExtConfigure{ + add to preset={web image}{ + curl + }, +} + +Here is a cat downloaded online: \includegraphicsWeb[width=3cm]{http://placekitten.com/400/303}. +\end{codeexample} +By default, the |wget| and |curl| presets are defined as: +\begin{verbatim} +wget/.style={ + set compilation command={wget "__ROBEXT_MAIN_CONTENT__" -O "__ROBEXT_OUTPUT_PDF__"}, +}, +curl/.style={ + set compilation command={curl "__ROBEXT_MAIN_CONTENT__" -L -o "__ROBEXT_OUTPUT_PDF__"}, +}, +\end{verbatim} +\end{pgfmanualentry} + +\subsubsection{Gnuplot} + +We also provide support for gnuplot since v2.3. + +\begin{pgfmanualentry} + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/gnuplot\@nil + \extractkey/robExt/gnuplot/set terminal=\marg{terminal and options}\@nil + \extractkey/robExt/gnuplot/pdf terminal=\opt{pdf terminal options}\@nil + \extractkey/robExt/gnuplot/tikz terminal=\opt{tikz terminal options}\@nil + \makeatother% + \pgfmanualbody + Loads the |gnuplot| preset. By default, it uses the |pdf| terminal: +\begin{codeAndResult} +\begin{CacheMeCode}{gnuplot} +plot sin(x) +\end{CacheMeCode} +\end{codeAndResult} + +You can also specify the gnuplot options to the pdf terminal, like the size, using: +\begin{codeAndResult} +\begin{CacheMeCode}{gnuplot,pdf terminal={size 5cm,4cm}} +plot sin(x) +\end{CacheMeCode} +\end{codeAndResult} +You can also change the options of the |includegraphics| command used to include the image, using as usual: +\begin{codeAndResult} +\begin{CacheMeCode}{gnuplot,set includegraphics options={width=5cm,height=4cm}} +plot sin(x) +\end{CacheMeCode} +\end{codeAndResult} +You can also use other terminals using the |set terminal| option. For instance, you can use the png terminal and configure its size using: +\begin{codeAndResult} +\begin{CacheMeCode}{gnuplot,set terminal={png size 400,300}} +plot sin(x) +\end{CacheMeCode} +\end{codeAndResult} +The tikz terminal is a bit special since we do not want to use |\includegraphics| but |\input| to include the file. You can use it like this, just make sure: +\begin{itemize} +\item to have gnuplot installed with lua support. With nix you can get it with:\\ + |nix-shell -p '(gnuplot.override { withLua = true; })'| +\item Add |\usepackage{gnuplot-lua-tikz}| after making sure to run\\ + |gnuplot -e "set terminal tikz createstyle"| once to create the |.sty| file. +\end{itemize} +\begin{codeAndResult} +% \usepackage{gnuplot-lua-tikz} %% Generate with gnuplot -e "set terminal tikz createstyle" +\begin{CacheMeCode}{gnuplot,tikz terminal={size 5cm,4cm}} +plot sin(x) +\end{CacheMeCode} +\end{codeAndResult} +(Note that if you do not provide any option to |tikz terminal|, it will just use the default value in gnuplot, you can also add any other option to the terminal here.) By default, we only cache the gnuplot compilation, but the |\input| is not cached (so gnuplot will not be run again the next time, but tikz will run every time). But it can also be cached, just add |cache tikz| for that: +\begin{codeAndResult} +\robExtConfigure{ + add to preset={tikz}{ + % Run gnuplot -e "set terminal tikz createstyle" in the robustExternalize folder first + % to create this file, or, better, run this command in your local folder and use + % "copy file to cache" to copy the 3 generated files.: + add to preamble={\usepackage{gnuplot-lua-tikz}}, + }, + add to preset={gnuplot}{ + tikz terminal/.append style={ + cache tikz, + }, + }, +} +\begin{CacheMeCode}{gnuplot, tikz terminal={size 8cm,5cm}} +plot cos(x) +\end{CacheMeCode} +\end{codeAndResult} +We also automatically add |__ROBEXT_WAY_BACK__| to the |loadpath|, this way you do NOT need to type |plot "__ROBEXT_WAY_BACK__yourfile.dat"`| if the data is in the main folder. Note however that you need to add this file to the list of dependencies, otherwise it will not be recompiled if the file changes: +\begin{codeAndResult} +\begin{CacheMeCode}{gnuplot, dependencies={gnuplot_data.dat}} +plot "gnuplot_data.dat" +\end{CacheMeCode} +\end{codeAndResult} + +You can also use the current text width when using the tikz terminal using something like:\\ +|tikz terminal/.expanded={size \lenToCm{\textwidth},\lenToCm{.3\textwidth}}|\\ +Full example: +\begin{codeAndResult} +% Just to check size: +\noindent\rule{\textwidth}{1mm}\\% +\begin{CacheMeCode}{gnuplot, tikz terminal/.expanded={size \lenToCm{\textwidth},\lenToCm{.3\textwidth}}} +plot cos(x) +\end{CacheMeCode} +\end{codeAndResult} + +Similar to the tikz terminal, you can also use the |cairolatex| terminal like this: +\begin{codeAndResult} +\begin{CacheMeCode}{gnuplot,cairolatex terminal} +plot sin(x) +\end{CacheMeCode} +\end{codeAndResult} +As before, you can also specify the size, for instance it term of the current textwidth: +\begin{codeAndResult} +\begin{CacheMeCode}{gnuplot, cairolatex terminal/.expanded={size \lenToCm{\textwidth},\lenToCm{.3\textwidth}}} +plot cos(x) +\end{CacheMeCode} +\end{codeAndResult} +\end{pgfmanualentry} + +\begin{pgfmanualentry} + \extractcommand\robExtGpgetvar\marg{variable name}\@@ + \extractcommand\robExtGpgetvarNb\opt{*}\opt{\oarg{text, default 404}}\marg{variable name}\@@ + \pgfmanualbody + Like |\gpgetvar{}| from |gnuplot-lua-tikz| but does not produce an error if the variable does not exist yet (mostly useful if you compile in parallel as shown \mylink{https://github.com/leo-colisson/robust-externalize/issues/17}{here}). The first time, you will get a message like: + + \robExtGpgetvar{test_variable} + + and later this will compile fine: +\begin{codeAndResult} +\begin{CacheMeCode}{gnuplot, tikz terminal={providevars test_variable}} +test_variable = 5 +plot cos(test_variable * x) title "Test2" +\end{CacheMeCode} +Variable is \robExtGpgetvar{test_variable}. +\end{codeAndResult} +|\robExtGpgetvarNb| is similar, except that it prints a number 404 by default (useful if you use it in siunit) and is expandable (also \mylink{https://github.com/leo-colisson/robust-externalize/issues/17}{needed for siunit}). You can choose another text using the optional argument. The star version prints a warning in the log if the variable does not exist, but can only be used in LuaLaTeX: +\begin{codeAndResult} +Variable is \num[round-mode=figures,round-precision=3]{\robExtGpgetvarNb{non_existing_variable}}. +\end{codeAndResult} +Note that you will get a warning if the variable does not exist (yet?) only in LuaLaTeX as in other engines there is no \mylink{https://tex.stackexchange.com/questions/705299/print-message-in-expandable-macro/705304}{way to write in the log with an expandable function}. +\end{pgfmanualentry} + +\subsubsection{TikZit} + +\mylink{https://tikzit.github.io/}{TikZit} is a software to produce \tikzname{} images via a graphical interface. + +\begin{pgfmanualentry} + \extractcommand\cacheTikzit\opt{\oarg{preset}}\@@ + \extractcommand\cacheTikzitWithStyle\opt{\oarg{preset}}\marg{name of style file}\@@ + \pgfmanualbody + (since v2.5) These command will automatically cache the |\tikzfig| command (and therefore also |\ctikzfig|). While |\cacheTikzit| will let you create the preset (named |tikzit| preset by default), |\cacheTikzitWithStyle| will automatically create the preset style for you, loading your style given as parameter: + \begin{codeexample}[vbox] + %%%%%%% In your preamble: + \cacheTikzitWithStyle{new_zxstyle.tikzstyles} + + %%%%%%% In your document: + \tikzfig{demo} % figures/ is optional + \end{codeexample} + If you prefer to do it manually, you can do instead: + \begin{codeexample}[vbox] + %%%%%%% In your preamble: + \robExtConfigure{ + % First, we copy the tikzit-related files to the cache: + copy file to cache={tikzit.sty}, + copy file to cache={new_zxstyle.tikzstyles}, + % We create the tikzit preset loaded by default: + new preset={tikzit}{ + latex, + add to preamble={ + \usepackage{tikzit} + \input{new_zxstyle.tikzstyles} + }, + }, + } + % Cache all tikzit figures: + \cacheTikzit + + %%%%%%% In your document: + \tikzfig{figures/demo} + \end{codeexample} + \textbf{WARNING:} since the tikz picture uses |baseline| that relies on the current font size to vertically align the figure, and since we do not yet propagate the current font size to the cached picture (there are so many ways to configure the font in \LaTeX\dots{}), you should make sure that the |tikzit| preset sets the font size like in your main document, for instance via: + \begin{codeexample}[vbox] + %%%%%%% In your preamble: + \cacheTikzitWithStyle{new_zxstyle.tikzstyles} + \robExtConfigure{ + add to preset={tikzit}{ + add to latex options={12pt}, + }, + } + %%%%%%% In your document: + \tikzfig{demo} % figures/ is optional + \end{codeexample} + Note that |\tikzfig| accepts an additional optional argument for further options, for instance to forward locally a macro or to disable externalization: + \begin{codeexample}[vbox] + %%%%%%% In your preamble, make sure to load: + %% \usepackage{tikzit} + %% \input{new_zxstyle.tikzstyles} + %% if you want "disable externalization" to work. + \cacheTikzitWithStyle{new_zxstyle.tikzstyles} + %%%%%%% In your document: + \tikzfig<disable externalization>{demo} % figures/ is optional + \end{codeexample} +\end{pgfmanualentry} + \subsubsection{Custom languages} To add support to new languages, see \cref{sec:otherLanguages} for an example. @@ -3632,10 +4292,19 @@ It might be handy to cache automatically a given environment: we already provide to cache all tikz pictures (unless externalization is disabled), but we also provide tools to handle arbitrary environments. \begin{pgfmanualentry} - \extractcommand\robExtExternalizeAllTikzpicture\opt{\oarg{preset for tikz}}\opt{\oarg{preset for tikzpicture}}\opt{\oarg{delimiters}}\@@ + \extractcommand\robExtExternalizeAllTikzpictures\opt{\oarg{preset for tikz}}\opt{\oarg{preset for tikzpicture}}\opt{\oarg{delimiters}}\@@ \extractcommand\cacheTikz\opt{\oarg{preset for tikz}}\opt{\oarg{preset for tikzpicture}}\opt{\oarg{delimiters}}\@@ + \extractcommand\robExtDoNotExternalizeAllTikzpictures\@@ + \extractcommand\doNotCacheTikz\@@ + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/cache tikz\@nil + \extractkey/robExt/cache tikz\@nil + \extractkey/robExt/cache tikz 2 args=\marg{tikz preset}\marg{tikzpicture preset}\@nil + \extractkey/robExt/cache tikz 3 args=\marg{tikz preset}\marg{tikzpicture preset}\marg{delimiters cacheMe options}\@nil + \makeatother% \pgfmanualbody - This will automatically cache all tikz pictures (both are alias, |\cacheTizk| is available from v2.0). Since v2.0, we added the delimiters options and we allow to specify custom presets for |tikz| and |tikzpicture|, and we parse |\tikz| as well (the |tikz| preset is now used by |\tikz| by default while the |tikzpicture| preset is used by |tikzpicture|). Note that we add an additional optional argument to the tikz picture via its first argument delimited by |delimiters| (defaults to |<>|) to specify preset options, which can for instance be practical to disable externalization on individual pictures. Cf.\ \cref{sec:disableExternalization} to see an example of use. + (|cache tikz*| from 2.3, simply style alias) This will automatically cache all tikz pictures (the |*ExternalizeAllTikzpicturers| are alias of the |*cacheTikz| which is available from v2.0). Since v2.0, we added the delimiters options and we allow to specify custom presets for |tikz| and |tikzpicture|, and we parse |\tikz| as well (the |tikz| preset is now used by |\tikz| by default while the |tikzpicture| preset is used by |tikzpicture|). Note that we add an additional optional argument to the tikz picture via its first argument delimited by |delimiters| (defaults to |<>|) to specify preset options, which can for instance be practical to disable externalization on individual pictures. Cf.\ \cref{sec:disableExternalization} to see an example of use. \begin{codeexample}[width=0pt,vbox] \cacheTikz @@ -3687,7 +4356,27 @@ You can also change the default style loaded for tikz and tikzpicture (note that \node(A){In tikzpicture \hello}; \end{tikzpicture} \end{codeexample} +Note that the |cache tikz| styles (the variation just provide default values) is useful for instance if you only want to locally enable |cache tikz| for the |\input| of a style (this way you can cache the output of a cached thing\dots{}). For instance, |gnuplot| with a tikz terminal will compile into a tex file that will be inputted. But unless |\cacheTikz| is enabled, the inputted picture will not be cached (i.e. tikz will need to run). If you still want to cache it without enabling |\cacheTikz| globally, you can load this style in the |gnuplot| style, or do something like: + +|\doNotCacheTikz| just undo |\cacheTikz|: +\begin{codeexample}[width=0pt,vbox] +\def\whereIAm{(not cached)} +\robExtConfigure{ + add to preset={tikz}{ + add to preamble={ + \def\whereIAm{(cached)} + }, + }, +} +\cacheTikz +\doNotCacheTikz + +\tikz \node[fill=pink, rounded corners]{\whereIAm}; +\begin{tikzpicture} + \node[fill=pink, rounded corners]{\whereIAm}; +\end{tikzpicture} +\end{codeexample} \end{pgfmanualentry} \begin{pgfmanualentry} @@ -3809,7 +4498,7 @@ Let us say that you want to cache all elements of a given environment, like |min \end{pgfmanualentry} \paragraph{Defining its own macro without repeating its definition.} -Note that when you define yourself a macro function, the above structure might not be optimal as you need to define the macro in the main document (in case you disable the externalization) and in the template. One option to avoid repeated code is to write the definition in a common input file (see \cref{sec:dependencies}), but you might prefer to keep everything in a single file. In that case, you can simply wrap your function into |cacheMe| yourself. Say you want your function to draw a circle like, |\tikz \draw[fill=#2] (0,0) circle [radius=#1];|, then wrap in inside |CacheMe|: +Note that when you define yourself a macro function, the above structure might not be optimal as you need to define the macro in the main document (in case you disable the externalization) and in the template. One option to avoid repeated code is to write the definition in a common input file (see \cref{sec:dependencies}), use |\runHereAndInPreambleOfCachedFiles| or |forward=\macroToExport|. But sometimes, you might need to do more involved operations, for instance to add a file as a dependency etc. So another solution it to wrap yourself your function into |cacheMe| yourself. Say you want your function to draw a circle like, |\tikz \draw[fill=#2] (0,0) circle [radius=#1];|, then wrap in inside |CacheMe|: \begin{codeexample}[width=0mm,vbox] % D<>{} is an optional argument enclosed in <>, we use this to pass arguments to CacheMe @@ -3899,9 +4588,77 @@ bash JOBNAME-robExt-compile-missing-figures.sh \subsection{How to debug}\label{sec:debug} -If for some reasons you are unable to understand why a build fails, first check if you compiled your document with |-shell-escape| (not that this must appear \textbf{before} the filename). Then, you can look at the log file to get more advices: when a cached document is compiled, we always write the full compilation command before compiling the file in the log file. This way, you can easily check the content of the file and see why it fails to compile. The compilation errors are also displayed directly in the output, and you can read the log file for details. +If for some reasons you are unable to understand why a build fails, first check if you compiled your document with |-shell-escape| (not that this must appear \textbf{before} the filename). + +Since v2.3, we provide a more advanced error handling system in order to provide more meaningful errors to the user, and to write the full compilation output in the log in case of an error. We do so by wrapping commands around something like |(my command) > somelog.tex 2>&1|; therefore nothing is printed on screen during the compilation of the cached picture, you only get a message if there is an error. +\begin{pgfmanualentry} + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/do not redirect compilation output\@nil + \makeatother + If you want to come back to the old behavior, that just runs the command is it either set this option, or set |\def\robExtDoNotRedirectOutput{}| and |\def\robExtDoNotRedirectOutputInManuallyCompileMissingFigures{}| (the last one will only concern commands written to the |robExt-compile-missing-figures.sh|, which is used in manual mode and in parallel mode). +\end{pgfmanualentry} + +Starting from 2.3, we also automatically print an actual error message like: +\begin{verbatim} +! Package robExt Error: On line 20: the pdf file +(robExt) +robustExternalize/robExt-F27CD43D192AA2668A16DEAA616591FF.pdf +(robExt) is not present. The compilation command "cd +(robExt) robustExternalize/ && xelatex -halt-on-error +(robExt) "robExt-F27CD43D192AA2668A16DEAA616591FF.tex"" used +(robExt) to compile the environment on line 20 certainly +(robExt) failed with errors: +(robExt) vvvvvv +(robExt) ! Package tikz Error: Giving up on this path. Did +(robExt) you forget a semicolon?. +(robExt) +(robExt) ^^^^^^ +(robExt) See full logs below (you might need to press ENTER +(robExt) to go to the next error) or in +(robExt) +robustExternalize/robExt-F27CD43D192AA2668A16DEAA616591FF-compilation.log. +\end{verbatim} +You can see inside the location in the main tex file of the block containing the error, we provide also the compilation command that lead to this error, and the lines of the log containing the word ``error'' (case insensitive), as well as the path to the full log of the compilation of the inner command, that you can also see if you continue the compilation by pressing Enter or by looking at the full log file, for instance in TeXstudio. This smaller message is often good enough in LaTeX, but usually not very good for languages that do not print the word ``error''. In that case, add to your preset: -You might often get an error |! Missing $ inserted.|: this is typically when a placeholder was left unreplaced (e.g.\ you forgot to define it, import it, or you forgot to wrap a command in |\evalPlaceholder{}|): since \LaTeX{} is asked to typeset |__something__|, it thinks that you are trying to write a subscript, and asks you to start first the math mode. +\begin{pgfmanualentry} + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/print whole file in error message\@nil + \extractkey/robExt/do not print whole file in error message\@nil + \makeatother + (Add this only in preset, do NOT set it globally) + If you want to print the whole file in the small error message because you do not want to inspect the full log file, you can use the style |print whole file in error message|. This is enabled by default on the gnuplot, python and bash presets for instance, but disabled in \LaTeX{} has it makes little sense to print thousands of log lines in the error. +\end{pgfmanualentry} + +\begin{pgfmanualentry} + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/texstudio\@nil + \extractkey/robExt/logs should show as errors\@nil + \extractkey/robExt/prefix log message with=\marg{string to prepend to log message}\@nil + \extractkey/robExt/spacing between lines in log=\marg{content to separate lines in log}\@nil + \makeatother + Some IDE like TeXstudio will only print lines starting with an exclamation mark, assuming that they are spaced enough, so to make the compilation errors more visible in the log, we can start every line in the log with a |!| (you can set it globally via |logs should show as errors| that internally calls |prefix log message with|) and separate all lines with enough empty lines using |spacing between lines in log|. For simplicity, we create |texstudio| to automatically configure these values so that errors print nicely in texstudio via: +\begin{verbatim} +\robExtConfigure{texstudio} +\end{verbatim} +This way you will get errors like: +\begin{verbatim} +-------- We print now the full log -------- +! sh: ligne 1: gnuplot : commande introuvable +-------- End of the full log -------- +\end{verbatim} +and the line |sh: ligne 1: gnuplot : commande introuvable| will appear in your IDE without going in the log file. Note that this will only be printed for items that enable |print whole file in error message| not to pollute the errors space when the log contains many lines (e.g. \LaTeX{}), but this is automatically enabled on most default presets. +\end{pgfmanualentry} + +Then, you can look at the log files\footnote{Either the latex one or the |-compilation.log| file, and sometimes try in a terminal if you really can't see any useful error as it might be the case that the error is not printed in the log file, which occurs for instance if xparse is not installed on Windows and you use the compilation command in parallel.} to get more advices, and run yourself the compilation command printed in the above error message. This way, you can easily check the content of the file and see why it fails to compile. In version before 2.3, or if you use |do not redirect compilation output|, the compilation errors are also displayed directly in the output, and you can read the log file for details. + +You might often get an error: +\begin{verbatim} +! Missing $ inserted. +\end{verbatim} +This is typically when a placeholder was left unreplaced (e.g.\ you forgot to define it, import it, or you forgot to wrap a command in |\evalPlaceholder{}|): since \LaTeX{} is asked to typeset |__something__|, it thinks that you are trying to write a subscript, and asks you to start first the math mode. To get more advanced info during the compilation command, set the style |more logs| (that does |\def\robExtDebugMessage#1{\message{^^J[robExt] #1}}|) in order to print some messages on the replacement process (there is also |\robExtDebugWarning| for more important messages, but it prints the logs by default. @@ -3948,6 +4705,15 @@ You can also use |debug| (or its alias |print command and source|) in order to d Show all imported placeholders and their content. Use the start not to pause. \end{pgfmanualentry} +\begin{pgfmanualentry} + \makeatletter% + \def\extrakeytext{style, } + \extractkey/robExt/nb lines after error to show=\marg{nb lines to keep}\@nil + \extractkey/robExt/remove line number\@nil + \extractkey/robExt/do not remove line number\@nil + \makeatother + In order to make the small error message more meaningful (to avoid getting to the full log), we try to extract some errors automatically, reading lines staring with |!|, or containing |error| or |invalid|. But this line alone is often not enough, so you can use |nb lines after error to show| to determine the number of lines to show after (defaults to 3). |remove line number| will remove in the short error message any |l.| at the beginning of the line, otherwise some editors (at least emacs), will interpret it as a line number in the current file and will jump to a bad position (this is enabled by default). These options would work best if set globally when you use |compile in parallel|. +\end{pgfmanualentry} \subsection{Advanced optimizations}\label{sec:advancedOperations} @@ -4006,36 +4772,58 @@ In order to know when to stop replacing placeholders earlier (i.e.\ without runn If you disable the import mechanism (enabled by default), it will do an |\importAllPlaceholders| while evaluating the template. This is not recommended as it is quite inefficient, it is better to selectively import the group you need. \end{pgfmanualentry} -\begin{pgfmanualentry} - \makeatletter% - \def\extrakeytext{style, } - \extractkey/robExt/disable optimizations\@nil - \extractkey/robExt/enable optimizations\@nil - \makeatother% - \pgfmanualbody - -\end{pgfmanualentry} +\section{Frequent errors} + +\subsection{Xelatex and tabs} +It seems that xelatex (I never had issues with pdflatex and lualatex, but if you get this error on other engines you can try the same fix) \mylink{https://tex.stackexchange.com/a/14776/116348}{has a hard time dealing with tabs} if you do not compile with: +\begin{verbatim} +xelatex -8bit yourfile.tex +\end{verbatim} +If you see that tabs in your input file are turned into |^^I| in the source code, you should either add the |-8bit| option\dots{} or simply follow egreg's advice: +\begin{center} + \emph{The strategy is very simple: never use TAB when dealing with TeX. Reserve the TAB key to trigger autocompletion and your life will be happier.} +\end{center} +If you use TeXstudio that uses Tabs by default, you can disable this feature by setting these two options: +\begin{verbatim} +Options > Configure TeXstudio > Editor > Replace indentation tabs with spaces +Options > Configure TeXstudio > Editor > Replace tabs in text with spaces +\end{verbatim} \section{TODO and known bugs:} \begin{itemize} \item See how to deal with label, links and cite inside pictures (without disabling externalization). For label and links, I have a proof of concept, I ``just'' need to write it down. \url{https://tex.stackexchange.com/questions/695277/clickable-includegraphics-for-cross-reference-data} \item Deal with remember picture -\item Since externalizing is all about speed, it would be nice to do more benchmarks. But overall, it seems fairly optimized, at least when using the compiled presets. -\item Add a way to forward tikz styles and/or arbitrary code. -\item Create a more efficient/precise way to check if a word is present than string ``is in''. Indeed, for now for each color/... to export, we check if the string contains this word, which scales like $O(sn)$ where $s$ is the size of the string and $n$ is the number of colors etc to export. Instead, I'd like to run it in $O(s)$ by extracting all words a single time, and then checking if this word exists or not. This is not an issue for |\newcommandAutoforward|, but could be an issue when exporting many colors or |\genericAutoForward|. +\item Since externalizing is all about speed, it would be nice to do more benchmarks. But overall, it seems fairly optimized, at least when using the compiled presets. One option to gain in term of efficiency and simplicity might be to directly use the fact that the placeholders start and end with two dashes: a more efficient implementation might be doable using something like |\def\findPlaceholders#1__#2__{}| instead of string replacement. I will try to investigate in future releases. \end{itemize} -\section{Acknowledgments} - -I am deeply indebted to many users on \url{tex.stackexchange.com} that made the writing of this library possible. I can't list you all, but thank you so much! A big thanks also to the project \url{https://github.com/sasozivanovic/memoize/} from which I borrowed most of the code to automatically wrap commands. Thanks to kiryph for providing useful feedbacks. - \section{Changelog} \begin{itemize} -\item Future v2.3 (master on github, not released yet on CTAN): +\item v2.5: + \begin{itemize} + \item Add tikzit support + \item Add support for |--output-directory| + \end{itemize} +\item v2.4: + \begin{itemize} + \item Better error message in wget if file not found + \item Add support for arXiv with |rename backup files for arxiv|, |print source when saving|, |backup source for arxiv|, |forward counter force value| + \item Add |\robExtMv|, |\robExtCp|, |set compilation command create if no error| and |set compilation command move if no error|. + \item Add |copy file to cache| + \end{itemize} +\item v2.3: + \begin{itemize} + \item Fix bug in |more logs| and |less logs| + \item Make |if matches word| more efficient, independent on the number of runs, allowing registration, namespaces, etc. + \item Added |\definecolorAutoForward| and |\colorletAutoForward| + \item Add support for gnuplot + \item Added |\runHereAndInPreambleOfCachedFiles| + \item Clearer and more advanced error handling + \item Add support for online images with |\includegraphicsWeb| + \end{itemize} \item v2.2 \begin{itemize} \item v2.1 introduced two important bugs where hashes could not be used in a |\cacheMe| environment, and |auto forward| was not working if the string was containing an environment. This is fixed now. @@ -4078,6 +4866,9 @@ I am deeply indebted to many users on \url{tex.stackexchange.com} that made the \printindex \end{document} +% Luatex is needed, otherwise quotes ' are turned into another symbol in documentation +% https://github.com/leo-colisson/robust-externalize/issues/11 % Local Variables: -% TeX-command-extra-options: "-shell-escape -halt-on-error" +% TeX-command-extra-options: "--shell-escape -halt-on-error" +% TeX-engine: luatex % End:
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-base/README.md b/macros/latex/contrib/tkz/tkz-base/README.md index 9c6b4a3d34..c4c1a749b1 100644 --- a/macros/latex/contrib/tkz/tkz-base/README.md +++ b/macros/latex/contrib/tkz/tkz-base/README.md @@ -1,6 +1,6 @@ # tkz-base — for Cartesian coordinate system -Release 4.2c 2022/07/14 +Release 4.21c 2024/01/16 ## Description The package `tkz-base` provides some tools like a Cartesian (rectangular) coordinate system to other packages like `tkz-euclide` or `tkz-fct`. @@ -60,6 +60,9 @@ Other examples, in French, are on my site. The new version of `tkz-base` is *not* fully compatible with the version 3 but the differences are minor ## History +- 4.21c Correction of bug tkz-obj-axes line 35, missing a symbol `%` (thanks Pascal Nuns) + + Replace in TKZdoc-base-points.tex p 462 tkzDefCentroid(A,B,C,O) by tkzDefBarycentric(A,B,C,O) - 4.2c adaptation to the new version of tkz-euclide. - 4.05b Correction of an option (tkzDrawY). Removing axesmin.tex Move from \newif\iftkz@integer to base.sty diff --git a/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-main.tex b/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-main.tex index 8302156108..a114a0f844 100644 --- a/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-main.tex +++ b/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-main.tex @@ -1,7 +1,7 @@ %!TEX TS-program = lualatex % encoding: utf8 % documentation of tkz-base.sty -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -21,10 +21,10 @@ ]{tkz-doc} %\usepackage{etoc} \gdef\tkznameofpack{tkz-base} -\gdef\tkzversionofpack{4.2c} +\gdef\tkzversionofpack{4.21c} \gdef\tkzdateofpack{\today} \gdef\tkznameofdoc{doc-tkz-base} -\gdef\tkzversionofdoc{4.2c} +\gdef\tkzversionofdoc{4.21c} \gdef\tkzdateofdoc{\today} \gdef\tkzauthorofpack{Alain Matthes} \gdef\tkzadressofauthor{} diff --git a/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-point.tex b/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-point.tex index ee25236f64..a6321cfc98 100644 --- a/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-point.tex +++ b/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-point.tex @@ -459,7 +459,7 @@ Here the points are positioned relative to the center of gravity of $A,B,C \ \te \tkzGetPoint{B} \tkzDrawPoints(O,A,B,C) \tkzDrawSegments(C,B B,A A,O O,C) - \tkzDefCentroid(A,B,C,O) + \tkzDefBarycentricPoint(A=1,B=1,C=1,O=1) \tkzDrawPoint(tkzPointResult) \tkzAutoLabelPoints[center=tkzPointResult, dist=.3,red](O,A,B,C) diff --git a/macros/latex/contrib/tkz/tkz-base/doc/tkz-base.pdf b/macros/latex/contrib/tkz/tkz-base/doc/tkz-base.pdf Binary files differindex 79495febbf..820469cef4 100644 --- a/macros/latex/contrib/tkz/tkz-base/doc/tkz-base.pdf +++ b/macros/latex/contrib/tkz/tkz-base/doc/tkz-base.pdf diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.cfg b/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.cfg index 4d05fb564a..631dcece53 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.cfg +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.cfg @@ -1,5 +1,5 @@ % tkz-base.cfg -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -16,9 +16,9 @@ % and save the file in a directory part of your TEXINPUTS environment % variable. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-base.cfg} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-base.cfg} %<------ colors ---------------------------------------–> \def\tkz@backgroundcolor{white} \def\tkz@textcolor{black} @@ -134,7 +134,7 @@ arc style/.style={% \def\tkz@mk@fill{\tkz@otherlinecolor} %<--------------------------------------------------------------------------–> %<------------------------------ styles ---------------------------------–> -\def\tkzSetUpStyle[#1]#2{\tikzset{#2/.style={#1}}}% add 2022 +\def\tkzSetUpStyle[#1]#2{\tikzset{#2/.style={#1}}}% add 2024 \tikzset{xlabel style/.style = {below = 3 pt, inner sep = 1pt, diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.sty b/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.sty index 0cea394871..347d87fe70 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.sty +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-base.sty @@ -1,5 +1,5 @@ % tkz-base.sty % -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,10 +10,10 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\typeout{2022/07/14 4.2c tkz-base.sty} +\def\fileversion{4.21c} +\typeout{2024/01/16 4.21c tkz-base.sty} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tkz-base}[2022/07/14 4.2c tkz-base] +\ProvidesPackage{tkz-base}[2024/01/16 4.21c tkz-base] \@ifpackageloaded{tkz-euclide}{\typeout{tkz-base and tkz-fct must be loaded before tkz-euclide} \PackageError{tkz-base}{tkz-base must be loaded before tkz-euclide}{tkz-base must be loaded before tkz-euclide}% \endinput}{} diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-marks.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-marks.tex index 8cb6a366a6..4f40bee35b 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-marks.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-marks.tex @@ -1,5 +1,5 @@ % tkz-lib-marks.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-lib-marks.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-lib-marks.tex} \makeatletter %<--------------------------------------------------------------------------–> % Création des symboles diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-shape.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-shape.tex index 8f45042a1b..1ed58295b5 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-shape.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-lib-shape.tex @@ -1,5 +1,5 @@ % tkz-lib-shape.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-lib-shape.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-lib-shape.tex} \makeatletter %<--------------------------------------------------------------------------–> % Création des symboles diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axes.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axes.tex index 1baf269bf9..530e405347 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axes.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-axes.tex @@ -1,5 +1,5 @@ % tkz-obj-axes.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-obj-axes} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-obj-axes} \makeatletter \def\removedot#1.{#1} @@ -32,7 +32,7 @@ % some tools %<--------------------------------------------------------------------------–> \def\tkz@showgrad#1{% -\tkzgetinteger{#1} +\tkzgetinteger{#1}% \iftkz@integer\edef\tkz@result{\fpeval{trunc(#1,0)}}\else\edef\tkz@result{#1}\fi}% \def\tkz@Xresult{% diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex index 654a29c49c..c7ba978f07 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex @@ -1,5 +1,5 @@ % tkz-obj-grids.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-obj-grids.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-obj-grids.tex} \makeatletter %<--------------------------------------------------------------------------–> % Setup Grid diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-marks.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-marks.tex index 6b39328d0d..5e0f01c604 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-marks.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-marks.tex @@ -1,5 +1,5 @@ %tkz-obj-marks.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-obj-marks.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-obj-marks.tex} \makeatletter %<-------------------------------------------------------------------------–> % Setup Marks diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-points.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-points.tex index 21f2987bb9..c5e364753a 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-points.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-points.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-points.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14 } -\typeout{2022/07/14 4.2c tkz-obj-points.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16 } +\typeout{2024/01/16 4.21c tkz-obj-points.tex} \makeatletter %<---------------------------------------------------------------------------> % init def point diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-rep.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-rep.tex index 7ec1e86626..b42ad25e50 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-rep.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-rep.tex @@ -1,5 +1,5 @@ % tkz-obj-rep.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-obj-rep.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-obj-rep.tex} \makeatletter %<--------------------------------------------------------------------------–> % repère diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-BB.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-BB.tex index 8d2f196f30..9246f98b45 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-BB.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-BB.tex @@ -1,5 +1,5 @@ % tkz-tools-BB.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-obj-BB.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-obj-BB.tex} \makeatletter %<--------------------------------------------------------------------------–> \def\tkzShowBB{\pgfutil@ifnextchar[{\tkz@ShowBB}{\tkz@ShowBB[]}} diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-arith.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-arith.tex index 2a163531a7..059e6b331d 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-arith.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-arith.tex @@ -1,5 +1,5 @@ % tkz-tools-arith.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-tools-arith.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-tools-arith.tex} % 1.161 test if "isfactor" is already defined % now with pgf 3.0 gcd isprime isodd iseven are defined %<--------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-base.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-base.tex index 85955e1461..1a82a38b90 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-base.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-base.tex @@ -1,5 +1,5 @@ % tkz-tools-base.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-tools-base.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-tools-base.tex} \makeatletter %<--------------------------------------------------------------------------–> \global\let\tkz@tmp@xa\tkz@init@xmin% modif 2016 diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-colors.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-colors.tex index 9beab795b0..582f97b04b 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-colors.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-colors.tex @@ -1,5 +1,5 @@ % tkz-tools-colors -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-tools-colors} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-tools-colors} \makeatletter %<------ Initialisation of the colors with tkzSetUpColors -----------------> diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-misc.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-misc.tex index 83ae7c231c..f36f4e6b21 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-misc.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-misc.tex @@ -1,5 +1,5 @@ % tkz-tools-misc.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-tools-misc.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-tools-misc.tex} \makeatletter %<--------------------------------------------------------------------------–> % hline pb avec line diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-modules.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-modules.tex index f662f8bfbe..ad378a78a2 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-modules.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-modules.tex @@ -1,5 +1,5 @@ % tkz-tools-modules -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-tools-modules.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-tools-modules.tex} \makeatletter %<------------- % chargement des modules ----------------------------------> \def\tkz@obj@all{angles,arcs,compass,defcircles,deflines,defpoints,defpointsby,defpointsrnd,defpointswith,polygons,protractor,sectors,show,triangles}% diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-print.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-print.tex index 9776e57679..6b150d3314 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-print.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-print.tex @@ -1,5 +1,5 @@ % tkz-tool-print.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-tools-print} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-tools-print} \makeatletter %<------------- tkzPrintFrac ----------------------------------> \def\tkzPrintFrac#1#2{% diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-text.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-text.tex index 5c1f7fb8af..f8f236567c 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-text.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-text.tex @@ -1,5 +1,5 @@ % tkz-tools-text.tex -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-tools-text.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-tools-text.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzText diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-utilities.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-utilities.tex index f132d6053a..be21c796c3 100644 --- a/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-utilities.tex +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-tools-utilities.tex @@ -1,5 +1,5 @@ % tkz-tools-eu-utilities -% Copyright 2022 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{4.2c} -\def\filedate{2022/07/14} -\typeout{2022/07/14 4.2c tkz-tools-utilities.tex} +\def\fileversion{4.21c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 4.21c tkz-tools-utilities.tex} \makeatletter \pgfkeys{/tkzClip/.cd, space/.store in = {\tkz@CLI@space}, diff --git a/macros/latex/contrib/tkz/tkz-elements/README.md b/macros/latex/contrib/tkz/tkz-elements/README.md index a357bf2bf0..f5bfcebc80 100644 --- a/macros/latex/contrib/tkz/tkz-elements/README.md +++ b/macros/latex/contrib/tkz/tkz-elements/README.md @@ -1,10 +1,10 @@ # tkz-elements — for euclidean geometry -Release 1.72c 2023/12/24 +Release 1.82c 2024/01/16 ## Description -`tkz-elements v.1.72c` is the new version of a library written in lua, allowing to make all the necessary calculations to define the objects of a Euclidean geometry figure. You need to compile with `LuaLaTeX`. With `tkz-elements`, the definitions and calculations are only done with `Lua`. +`tkz-elements v.1.82c` is the new version of a library written in lua, allowing to make all the necessary calculations to define the objects of a Euclidean geometry figure. You need to compile with `LuaLaTeX`. With `tkz-elements`, the definitions and calculations are only done with `Lua`. The main possibility of programmation proposed is oriented "object programming" with object classes like point, line, triangle, circle and ellipse. For the moment, once the calculations are done, it is `tkz-euclide` or `TikZ` which allows the drawings. @@ -60,6 +60,38 @@ An important example `Golden Arbelos` using the package is on the site. All the are on the site. ## History + - version 1.82c + - Point object : name like z.App now gives a node with name A'' + - Modification of methods north,south + - Added the function length(z.A,z.B) shortcut for point.abs(z.A-z.B). + - Line object added some methods + - Added method in\_out\_segment + - (sacred triangle) + - gold + - sublime or euclide + - cheops + - divine + - pythagoras or isis or egyptian + - golden + - (classic triangles) + - two\_angles (side between) + - sss (three sides) + - ssa (two sides and an angle) + - sas (an angle between two sides) + - school (30°, 60° and 90°) + - half right triangle in A with AB= 2AC + - Circle object + - added method common_tangent (gives the common tangents of two circles) + - Correction for a bug and an oversight in the circles_position method. + - Rewriting the radical_axis methods + - Triangle object + - method trilinear (to use trilinear coordinates) + - method barycentric (to use barycentric coordinates) + - Added some functions + - bisector (a,b,c) altitude (a,b,c) bisector_ext(a,b,c) equilateral (a,b) midpoint (a,b) to avoid creating unnecessary objects. + - Added new examples and a cheat sheet in the documentation + + - version 1.72c - added a line method (apollonius) set of points M with MA/MB = k diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex index a945f3de7c..4dd3b75b60 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex @@ -13,18 +13,20 @@ This class is also defined by two points: on the one hand, the center and on the \bgroup \catcode`_=12 \small -\captionof{table}{Circle attributes.} +\captionof{table}{Circle attributes.}\label{circle:att} \begin{tabular}{lll} \toprule \textbf{Attributes} & \textbf{Application} &\\ \Iattr{circle}{center} & |z.A = C.AB.center| &\\ \Iattr{circle}{through} & |z.B = C.AB.through| &\\ -\Iattr{circle}{type} & |C.AB.type| &\tkzar |C.OA.type = 'circle'|\\ -\Iattr{circle}{radius} & |C.AB.radius| &\tkzar |r = C.OA.radius | $r$ real number\\ -\Iattr{circle}{north} & |C.AB.north| &\tkzar |z.N = C.OA.north|\\ -\Iattr{circle}{south} & |C.AB.south| & \tkzar |z.S = C.OA.south| \\ -\Iattr{circle}{east} & |C.AB.east| &\tkzar |z.E = C.OA.east| \\ -\Iattr{circle}{west} & |C.AB.west| &\tkzar |z.W = C.OA.west| \\ +\Iattr{circle}{type} & |C.AB.type| & |C.OA.type = 'circle'|\\ +\Iattr{circle}{radius} & |C.AB.radius| & |r = C.OA.radius | $r$ real number\\ +\Iattr{circle}{north} & |C.AB.north| & |z.N = C.OA.north|\\ +\Iattr{circle}{south} & |C.AB.south| & |z.S = C.OA.south| \\ +\Iattr{circle}{east} & |C.AB.east| & |z.E = C.OA.east| \\ +\Iattr{circle}{west} & |C.AB.west| & |z.W = C.OA.west| \\ +\Iattr{circle}{opp} & |z.Ap = C.AB.opp| & see (\ref{ssub:example_circle_attributes}) \\ +\Iattr{circle}{ct} & |L = C.AB.ct| & see (\ref{ssub:example_circle_attributes}) \\ \bottomrule % \end{tabular} \egroup @@ -44,14 +46,16 @@ Three attributes are used (south, west, radius). z.s = C.ab.south z.w = C.ab.west r = C.ab.radius + z.c = C.ab.opp + z.r,z.t = get_points (C.ab.ct : ortho_from (z.b)) \end{tkzelements} \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPoints(a,b,s,w) - \tkzLabelPoints(a,b,s,w) - \tkzDrawCircle(a,b) - \tkzDrawSegment(a,b) - \tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{r}} +\tkzGetNodes +\tkzDrawPoints(a,b,c,s,w) +\tkzLabelPoints(a,b,c,s,w) +\tkzDrawCircle(a,b) +\tkzDrawSegments(a,b r,t b,c) +\tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{r}} \end{tikzpicture} \end{tkzexample} \end{minipage} @@ -64,15 +68,16 @@ Three attributes are used (south, west, radius). z.s = C.ab.south z.w = C.ab.west r = C.ab.radius + z.c = C.ab.opp + z.r,z.t = get_points (C.ab.ct : ortho_from (z.b)) \end{tkzelements} - \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes -\tkzDrawPoints(a,b,s,w) -\tkzLabelPoints(a,b,s,w) +\tkzDrawPoints(a,b,c,s,w) +\tkzLabelPoints(a,b,c,s,w) \tkzDrawCircle(a,b) -\tkzDrawSegment(a,b) +\tkzDrawSegments(a,b r,t b,c) \tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{r}} \end{tikzpicture} \hspace*{\fill} @@ -86,45 +91,49 @@ Three attributes are used (south, west, radius). \bgroup \catcode`_=12 \small -\captionof{table}{Circle methods.} +\captionof{table}{Circle methods.}\label{circle:met} \begin{tabular}{lll} \toprule \textbf{Methods} & \textbf{Comments} & \\ \midrule \\ \Imeth{circle}{new(O,A)} & |C.OA = circle : new (z.O,z.A)| & circle center $O$ through $A$\\ \Imeth{circle}{radius(O,r)} & |C.OA = circle : radius (z.O,2)| & circle center $O$ radius =2 cm\\ +\Imeth{circle}{diameter(A,B)} & |C.OA = circle :diameter(z.A,z.B)| & circle diameter $[AB]$ \\ \midrule \textbf{Points} &&\\ \midrule \Imeth{circle}{antipode (pt)} & |z.C = C.OA: antipode (z.B)| & $[BC]$ is a diameter \\ \Imeth{circle}{inversion (pt)} & |z.Bp = C.AC: inversion (z.B)|&\\ -\Imeth{circle}{midarc (z1,z2)} & |z.D = C.AB: midarc (z.B,z.C)|& $D$ is the midarc of $\widearc{BC}$\\ -\Imeth{circle}{point (t)} & |z.E = C.AB: point (0.25)|& |t| between 0 and 1\\ +\Imeth{circle}{midarc (pt,pt)} & |z.D = C.AB: midarc (z.B,z.C)|& $D$ is the midarc of $\widearc{BC}$\\ +\Imeth{circle}{point (r)} & |z.E = C.AB: point (0.25)|& |r| between 0 and 1\\ \Imeth{circle}{random\_pt(lower, upper)} & &\\ \Imeth{circle}{internal\_similitude (C)} & |z.I = C.one : internal_similitude (C.two)| &\\ \Imeth{circle}{external\_similitude (C)} & |z.J = C.one : external_similitude (C.two)| & \\ +\Imeth{circle}{radical\_center (C1<,C2>)} & or only (C1) & see \ref{sub:radical_center} \\ \midrule \textbf{Lines} & & \\ \midrule -\Imeth{circle}{radical\_axis (C)} & & \\ -\Imeth{circle}{tangent\_at (pt)} & |z.P = C.OA: tangent_at (z.M)| & $((PM) \perp (OM))$\\ -\Imeth{circle}{tangent\_from (pt)}& |z.M,z.N = C.OA: tangent_from (z.P)| &\\ -\Imeth{circle}{inversion (line)} & |L or C = C.AC: inversion (L.EF)|&\\ +\Imeth{circle}{radical\_axis (C)} & see ( \ref{sub:d_alembert_2} ; \ref{sub:radical_axis_v1} ; \ref{sub:radical_axis_v2} ; \ref{sub:radical_axis_v3} ; \ref{sub:radical_axis_v4})& \\ +\Imeth{circle}{tangent\_at (pt)} & |z.P = C.OA: tangent_at (z.M)| & see (\ref{ssub:lemoine} ; \ref{ssub:example_combination_of_methods})\\ +\Imeth{circle}{tangent\_from (pt)}& |z.M,z.N = C.OA: tangent_from (z.P)| & see (\ref{tangent_from})\\ +\Imeth{circle}{inversion (line)} & |L or C = C.AC: inversion (L.EF)|& see (\ref{ssub:inversion_line})\\ +\Imeth{circle}{common\_tangent (C)} & |z.a,z.b = C.AC: common_tangent (C.EF)|& see (\ref{sub:common_tangent} ; \ref{sub:common_tangent_orthogonality})\\ \midrule \textbf{Circles}& &\\ \midrule -\Imeth{circle}{orthogonal\_from (pt)} & |C = C.OA: orthogonal_from (z.P)| & \\ -\Imeth{circle}{orthogonal\_through (pta,ptb)} & |C = C.OA: orthogonal_through (z.z1,z.z2)|\\ +\Imeth{circle}{orthogonal\_from (pt)} & |C = C.OA: orthogonal_from (z.P)| & see (\ref{ssub:altshiller} ; \ref{sub:common_tangent_orthogonality} ; \ref{sub:orthogonal_circles_v1} ; \ref{sub:pencil_v1}) \\ +\Imeth{circle}{orthogonal\_through (pta,ptb)} & |C = C.OA: orthogonal_through (z.z1,z.z2)| & see (\ref{sub:orthogonal_circle_through})\\ \Imeth{circle}{inversion (...)} & | C.AC: inversion (pt, pts, L or C )|& see \ref{ssub:inversion}, \ref{ssub:inversion_point}, \ref{ssub:inversion_line}, \ref{ssub:inversion_circle}\\ \Imeth{circle}{midcircle (C)} & |C.inv = C.OA: midcircle (C.EF)| & see \ref{ssub:midcircle} \\ +\Imeth{circle}{radical\_circle (C1<,C2>)} & or only (C1) & see \ref{sub:radical_circle}\\ \midrule \textbf{Miscellaneous} &&\\ \midrule -\Imeth{circle}{power (pt)} &|p = C.OA: power (z.M)| & power with respect to a circle \\ -\Imeth{circle}{in\_out (pt)} & |C.OA : in_out (z.M)| & boolean \\ -\Imeth{circle}{in\_out\_disk (pt)} & |C.OA : in_out_disk (z.M)| & boolean \\ +\Imeth{circle}{power (pt)} &|p = C.OA: power (z.M)| & see (\ref{sub:power_v1} ; \ref{sub:power_v2} ; \ref{sub:apollonius_circle_v1_with_inversion}) \\ +\Imeth{circle}{in\_out (pt)} & |C.OA : in_out (z.M)| & see (\ref{sub:in_out_for_circle_and_disk}) \\ +\Imeth{circle}{in\_out\_disk (pt)} & |C.OA : in_out_disk (z.M)| & see (\ref{sub:in_out_for_circle_and_disk}) \\ \Imeth{circle}{draw ()} & for further use &\\ -\Imeth{circle}{circles\_position (C1,C2)} & see \ref{sub:circles_position} \\ +\Imeth{circle}{circles\_position (C1)} & result = string &see (\ref{sub:circles_position}) \\ \bottomrule \end{tabular} \egroup @@ -570,7 +579,7 @@ z.X,z.Y = intersection (C.AO,C.BP) This case is a little more complicated. We'll construct the two circles $(\alpha)$ and $(\beta)$ tangent to the two given circles. Then we construct the radical circle orthogonal to the circles $(\alpha)$ and $(\beta)$. Its center is the radical center as well as the center of internal similtude of circles of center $A$ and $B$. \item When the two given circles are external to each other, we construct the external center of similitude of the two given circles. -$I$ is the center of external similarity of the two given circles. To obtain the inversion circle, simply note that $H$ is such that $IH^2= IE\times IF$ +$I$ is the center of external similarity of the two given circles. To obtain the inversion circle, simply note that $H$ is such that $IH^2= IE\times IF$. \label{tangent_from} \begin{minipage}{.4\textwidth} \begin{verbatim} @@ -757,13 +766,13 @@ Cette fonction retourne une chaîne qui indique la position du cercle par rappor \begin{minipage}{.5\textwidth} \begin{verbatim} \begin{tkzelements} - z.A = point : new ( 0 , 0 ) - z.a = point : new ( 3 , 0 ) - z.B = point : new ( 2 , 0 ) - z.b = point : new ( 3 , 0 ) - C.Aa = circle: new (z.A,z.a) - C.Bb ·= circle: new (z.B,z.b) - position = circles_position (C.Aa,C.Bb) + z.A = point : new ( 0 , 0 ) + z.a = point : new ( 3 , 0 ) + z.B = point : new ( 2 , 0 ) + z.b = point : new ( 3 , 0 ) + C.Aa = circle: new (z.A,z.a) + C.Bb = circle: new (z.B,z.b) + position = C.Aa : circles_position (C.Bb) if position == "inside tangent" then color = "orange" else color = "blue" end @@ -784,7 +793,7 @@ z.B = point : new ( 2 , 0 ) z.b = point : new ( 3 , 0 ) C.Aa = circle: new (z.A,z.a) C.Bb = circle: new (z.B,z.b) -position = circles_position (C.Aa,C.Bb) +position = C.Aa : circles_position (C.Bb) if position == "inside tangent" then color = "orange" else color = "blue" end \end{tkzelements} \hspace{\fill} @@ -795,5 +804,214 @@ if position == "inside tangent" then color = "orange" else color = "blue" end \end{tikzpicture}\hspace{\fill} \end{minipage} % subsection circles__position (end) + +\subsection{Common tangent: Angle of two intersecting circles} % (fold) +\label{sub:common_tangent} + +Let be a tangent common to both circles at $T$ and $T'$ (closest to $C$). Let a secant parallel to this tangent pass through $C$. Then the segment $[TT']$ is seen from the other common point $D$ at an angle equal to half the angle of the two circles. + +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 2 ) + L.AB = line : new ( z.A , z.B ) + z.C = point : new ( 1 , 2 ) + C.AC = circle : new (z.A,z.C) + C.BC = circle : new (z.B,z.C) + z.T,z.Tp = C.AC : common_tangent (C.BC) + L.TTp = line : new (z.T,z.Tp) + z.M = C.AC : point (0.45) + L.MC =line : new (z.M,z.C) + z.Mp = intersection (L.MC, C.BC) + L.mm = L.TTp : ll_from (z.C) + _,z.M = intersection (L.mm, C.AC) + z.Mp = intersection (L.mm, C.BC) + _,z.D = intersection (C.AC,C.BC) +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawSegments(M,M' A,D B,D A,B C,D T,C T',C) + \tkzDrawSegments[gray](D,M D,M' T,T' D,T D,T') + \tkzDrawPoints(A,B,C,D,M,M',T,T') + \tkzLabelPoints(A,B,D,M) + \tkzLabelPoints[above](C,M',T,T') + \tkzMarkAngles[mark=|,size=.75](T,C,M C,T,T' C,D,T T,D,M) + \tkzMarkAngles[mark=||,size=.75](M',C,T' T,T',C T',D,C M',D,T') +\end{tikzpicture} +\end{verbatim} + + +\begin{tkzelements} +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 5 , 2 ) +L.AB = line : new ( z.A , z.B ) +z.C = point : new ( 1 , 2 ) +C.AC = circle : new (z.A,z.C) +C.BC = circle : new (z.B,z.C) +z.T,z.Tp = C.AC : common_tangent (C.BC) +L.TTp = line : new (z.T,z.Tp) +z.M = C.AC : point (0.45) +L.MC =line : new (z.M,z.C) +z.Mp = intersection (L.MC, C.BC) +L.mm = L.TTp : ll_from (z.C) +_,z.M = intersection (L.mm, C.AC) +z.Mp = intersection (L.mm, C.BC) +_,z.D = intersection (C.AC,C.BC) +\end{tkzelements} +\hspace*{\fill} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircles(A,C B,C) +\tkzDrawSegments(M,M' A,D B,D A,B C,D T,C T',C) +\tkzDrawSegments[gray](D,M D,M' T,T' D,T D,T') +\tkzDrawPoints(A,B,C,D,M,M',T,T') +\tkzLabelPoints(A,B,D,M) +\tkzLabelPoints[above](C,M',T,T') +\tkzMarkAngles[mark=|,size=.75](T,C,M C,T,T' C,D,T T,D,M) +\tkzMarkAngles[mark=||,size=.75](M',C,T' T,T',C T',D,C M',D,T') +\end{tikzpicture} +\hspace*{\fill} + +% subsection common_tangent (end) + +\subsection{Common tangent: orthogonality} % (fold) +\label{sub:common_tangent_orthogonality} +For two circles to be orthogonal, it is necessary and sufficient for a secant passing through one of their common points to be seen from the other common point at a right angle. + +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 4 , 2 ) + L.AB = line : new ( z.A , z.B ) + z.a = point : new ( 1 , 2 ) + C.Aa = circle : new (z.A,z.a) + C.BC = C.Aa : orthogonal_from (z.B) + z.C,z.D = intersection (C.Aa,C.BC) + C.AC = circle : new (z.A,z.C) + z.T,z.Tp = C.AC : common_tangent (C.BC) + L.TTp = line : new (z.T,z.Tp) + z.M = C.AC : point (0.45) + L.MC =line : new (z.M,z.C) + z.Mp = intersection (L.MC, C.BC) + L.mm = L.TTp : ll_from (z.C) + _,z.M = intersection (L.mm, C.AC) + z.Mp = intersection (L.mm, C.BC) +\end{tkzelements} + +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawSegments(M,M' A,C B,C A,B) + \tkzDrawSegments[gray](D,M D,M' T,T') + \tkzDrawPoints(A,B,C,D,M,M',T,T') + \tkzLabelPoints(A,B,D,M) + \tkzLabelPoints[above](C,M',T,T') + \tkzMarkRightAngles(M',D,M A,C,B) +\end{tikzpicture} +\end{verbatim} + +\begin{tkzelements} +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 4 , 2 ) +L.AB = line : new ( z.A , z.B ) +z.a = point : new ( 1 , 2 ) +C.Aa = circle : new (z.A,z.a) +C.BC = C.Aa : orthogonal_from (z.B) +z.C,z.D = intersection (C.Aa,C.BC) +C.AC = circle : new (z.A,z.C) +z.T,z.Tp = C.AC : common_tangent (C.BC) +L.TTp = line : new (z.T,z.Tp) +z.M = C.AC : point (0.45) +L.MC =line : new (z.M,z.C) +z.Mp = intersection (L.MC, C.BC) +L.mm = L.TTp : ll_from (z.C) +_,z.M = intersection (L.mm, C.AC) +z.Mp = intersection (L.mm, C.BC) +\end{tkzelements} + \hspace*{\fill} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawSegments(M,M' A,C B,C A,B) + \tkzDrawSegments[gray](D,M D,M' T,T') + \tkzDrawPoints(A,B,C,D,M,M',T,T') + \tkzLabelPoints(A,B,D,M) + \tkzLabelPoints[above](C,M',T,T') + \tkzMarkRightAngles(M',D,M A,C,B) +\end{tikzpicture} +\hspace*{\fill} +% subsection common_tangent_orthogonality (end) + +\subsection{In\_out for circle and disk} % (fold) +\label{sub:in_out_for_circle_and_disk} + +\begin{verbatim} +\begin{tkzelements} +z.O = point : new (0,0) +z.A = point : new (1,2) +C.OA = circle : new (z.O,z.A) +z.N = point : new (-2,2) +z.M = point : new (1,0) +z.P = point : new (2,1) +BCm = C.OA : in_out (z.M) +BDm = C.OA : in_out_disk (z.M) +BCn = C.OA : in_out (z.N) +BDn = C.OA : in_out_disk (z.N) +BCp = C.OA : in_out (z.P) +BDp = C.OA : in_out_disk (z.P) +\end{tkzelements} +\def\tkzPosPoint#1#2#3#4{% +\tkzLabelPoints(O,M,N,P) + \ifthenelse{\equal{\tkzUseLua{#1}}{true}}{ + \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){on the #3}}{% + \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){out the #3}}} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawSegments[dashed](O,M O,N O,P) +\tkzDrawCircle(O,A) +\tkzDrawPoints(O,M,N,P) +\tkzPosPoint{BCm}{M}{circle}{8} +\tkzPosPoint{BCn}{N}{circle}{8} +\tkzPosPoint{BCp}{P}{circle}{8} +\tkzPosPoint{BDm}{M}{disk}{14} +\tkzPosPoint{BDn}{N}{disk}{14} +\tkzPosPoint{BDp}{P}{disk}{14} +\end{tikzpicture} +\end{verbatim} + +\begin{tkzelements} +z.O = point : new (0,0) +z.A = point : new (1,2) +C.OA = circle : new (z.O,z.A) +z.N = point : new (-2,2) +z.M = point : new (1,0) +z.P = point : new (2,1) +BCm = C.OA : in_out (z.M) +BDm = C.OA : in_out_disk (z.M) +BCn = C.OA : in_out (z.N) +BDn = C.OA : in_out_disk (z.N) +BCp = C.OA : in_out (z.P) +BDp = C.OA : in_out_disk (z.P) +\end{tkzelements} +\def\tkzPosPoint#1#2#3#4{% +\tkzLabelPoints(O,M,N,P) + \ifthenelse{\equal{\tkzUseLua{#1}}{true}}{ + \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){on the #3}}{% + \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){out the #3}} +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawSegments[dashed](O,M O,N O,P) +\tkzDrawCircle(O,A) +\tkzDrawPoints(O,M,N,P) +\tkzPosPoint{BCm}{M}{circle}{8} +\tkzPosPoint{BCn}{N}{circle}{8} +\tkzPosPoint{BCp}{P}{circle}{8} +\tkzPosPoint{BDm}{M}{disk}{14} +\tkzPosPoint{BDn}{N}{disk}{14} +\tkzPosPoint{BDp}{P}{disk}{14} +\end{tikzpicture} +% subsection in_out_for_circle_and_disk (end) % section class_circle (end) \endinput diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex index e700019fa3..bbe39aa1a2 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex @@ -10,7 +10,7 @@ The first attributes are the three points that define the ellipse : \Iattr{ellip \bgroup \catcode`_=12 \small -\captionof{table}{Ellipse attributes.} +\captionof{table}{Ellipse attributes.}\label{ellipse:att} \begin{tabular}{ll} \toprule \textbf{Attributes} & \textbf{Application}\\ @@ -34,84 +34,85 @@ The first attributes are the three points that define the ellipse : \Iattr{ellip \subsubsection{Atributes of an ellipse: example} % (fold) \label{ssub:attributes_of_an_ellipse} -\begin{tkzexample}[latex=0cm,small,code only] -\begin{tkzelements} - z.C = point: new (3 , 2) - z.A = point: new (5 , 1) - L.CA = line : new (z.C,z.A) - z.b = L.CA.north_pa - L = line : new (z.C,z.b) - z.B = L : point (0.5) - E = ellipse: new (z.C,z.A,z.B) - a = E.Rx - b = E.Ry - z.F1 = E.Fa - z.F2 = E.Fb - slope = math.deg(E.slope) - z.E = E.east - z.N = E.north - z.W = E.west - z.S = E.south - z.Co = E.covertex - z.Ve = E.vertex -\end{tkzelements} -\begin{tikzpicture} +\begin{minipage}{.5\textwidth} + \begin{verbatim} + \begin{tkzelements} + z.C = point: new (3 , 2) + z.A = point: new (5 , 1) + L.CA = line : new (z.C,z.A) + z.b = L.CA.north_pa + L = line : new (z.C,z.b) + z.B = L : point (0.5) + E = ellipse: new (z.C,z.A,z.B) + a = E.Rx + b = E.Ry + z.F1 = E.Fa + z.F2 = E.Fb + slope = math.deg(E.slope) + z.E = E.east + z.N = E.north + z.W = E.west + z.S = E.south + z.Co = E.covertex + z.Ve = E.vertex + \end{tkzelements} + \begin{tikzpicture} + \pgfkeys{/pgf/number format/.cd,fixed,precision=2} + \tkzGetNodes + \tkzDrawCircles[teal](C,A) + \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b}, + \tkzUseLua{slope}) + \tkzDrawPoints(C,A,B,b,W,S,F1,F2) + \tkzLabelPoints(C,A,B) + \tkzDrawLine[add = .5 and .5](A,W) + \tkzLabelSegment[pos=1.5,above,sloped](A,W){% + slope = \pgfmathprintnumber{\tkzUseLua{slope}}} + \tkzLabelPoint[below](S){South} + \tkzLabelPoint[below left](F1){Focus 1} + \tkzLabelPoint[below left](F2){Focus 2} + \tkzLabelPoint[above right](Ve){Vertex ; East} + \tkzLabelPoint[above right](Co){Covertex ; North} + \end{tikzpicture} + \end{verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \begin{tkzelements} + z.C = point: new (3 , 2) + z.A = point: new (5 , 1) + L.CA = line : new (z.C,z.A) + z.b = L.CA.north_pa + L = line : new (z.C,z.b) + z.B = L : point (0.5) + E = ellipse: new (z.C,z.A,z.B) + a = E.Rx + b = E.Ry + z.F1 = E.Fa + z.F2 = E.Fb + slope = math.deg(E.slope) + z.E = E.east + z.N = E.north + z.W = E.west + z.S = E.south + z.Co = E.covertex + z.Ve = E.vertex + \end{tkzelements} + \hspace*{\fill} + \begin{tikzpicture} \pgfkeys{/pgf/number format/.cd,fixed,precision=2} \tkzGetNodes \tkzDrawCircles[teal](C,A) - \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b}, - \tkzUseLua{slope}) + \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b,W,S,F1,F2) \tkzLabelPoints(C,A,B) \tkzDrawLine[add = .5 and .5](A,W) - \tkzLabelSegment[pos=1.5,above,sloped](A,W){% - slope = \pgfmathprintnumber{\tkzUseLua{slope}}} + \tkzLabelSegment[pos=1.25,above,sloped](A,W){slope = \pgfmathprintnumber{\tkzUseLua{slope}}} \tkzLabelPoint[below](S){South} \tkzLabelPoint[below left](F1){Focus 1} \tkzLabelPoint[below left](F2){Focus 2} \tkzLabelPoint[above right](Ve){Vertex ; East} \tkzLabelPoint[above right](Co){Covertex ; North} -\end{tikzpicture} -\end{tkzexample} - -\begin{tkzelements} -z.C = point: new (3 , 2) -z.A = point: new (5 , 1) -L.CA = line : new (z.C,z.A) -z.b = L.CA.north_pa -L = line : new (z.C,z.b) -z.B = L : point (0.5) -E = ellipse: new (z.C,z.A,z.B) -a = E.Rx -b = E.Ry -z.F1 = E.Fa -z.F2 = E.Fb -slope = math.deg(E.slope) -z.E = E.east -z.N = E.north -z.W = E.west -z.S = E.south -z.Co = E.covertex -z.Ve = E.vertex -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\pgfkeys{/pgf/number format/.cd,fixed,precision=2} -\tkzGetNodes -\tkzDrawCircles[teal](C,A) -\tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) -\tkzDrawPoints(C,A,B,b,W,S,F1,F2) -\tkzLabelPoints(C,A,B) -\tkzDrawLine[add = .5 and .5](A,W) -\tkzLabelSegment[pos=1.5,above,sloped](A,W){slope = \pgfmathprintnumber{\tkzUseLua{slope}}} -\tkzLabelPoint[below](S){South} -\tkzLabelPoint[below left](F1){Focus 1} -\tkzLabelPoint[below left](F2){Focus 2} -\tkzLabelPoint[above right](Ve){Vertex ; East} -\tkzLabelPoint[above right](Co){Covertex ; North} -\end{tikzpicture} -\hspace*{\fill} + \end{tikzpicture} +\end{minipage} % \caption{Class Ellipse} % subsection attributes_of_an_ellipse (end) @@ -128,7 +129,7 @@ To do this, you'll need to use a \pkg{tkz-elements }function: \Igfct{package}{se \bgroup \catcode`_=12 \small -\captionof{table}{Ellipse methods.} +\captionof{table}{Ellipse methods.}\label{ellipse:met} \begin{tabular}{ll} \toprule \textbf{Methods} & \textbf{Example} \\ @@ -193,7 +194,7 @@ slope = math.deg(E.slope) \end{tikzpicture} \end{minipage} -The function \Igfct{package}{set\_lua\_to\_tex (list)} is used to define the macros that will be used to draw the ellipse with \TIKZ\ or \pkg{tkz-euclide}. +The function \Igfct{package}{tkzUseLua (variable)} is used to transfer values to \TIKZ\ or \pkg{tkz-euclide}. % subsubsection method_imeth_ellipse_new (end) @@ -203,7 +204,8 @@ The first two points are the foci of the ellipse. The third one is the vertex. W \emph{The function launches the |new| method, all the characteristics of the ellipse are defined.} -\begin{tkzexample}[latex=0cm,small,code only] +\begin{minipage}{0.6\textwidth} +\begin{verbatim} \begin{tkzelements} z.A = point: new (0 , 0) z.B = point: new (5 , 1) @@ -227,9 +229,6 @@ The first two points are the foci of the ellipse. The third one is the vertex. W a,b = E.Rx,E.Ry ang = math.deg(E.slope) \end{tkzelements} -\end{tkzexample} -\begin{minipage}{0.6\textwidth} - \begin{tkzexample}[latex=0cm,small,code only] \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -245,7 +244,7 @@ The first two points are the foci of the ellipse. The third one is the vertex. W \tkzLabelPoints[left](A) \tkzLabelPoints[right](B,I,S,H) \end{tikzpicture} -\end{tkzexample} +\end{verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} \begin{tkzelements} @@ -290,7 +289,7 @@ The first two points are the foci of the ellipse. The third one is the vertex. W % subsubsection function_tkzname_ellipse__foci (end) \subsubsection{Method \Imeth{ellipse}{point} and \Imeth{ellipse}{radii}} % (fold) -\label{ssub:method_point} +\label{ssub:ellipse_method_point} The method \Imeth{ellipse}{point} defines a point $M$ of the ellipse whose coordinates are $(a\times cos(phi), b\times sin(phi))$. |phi| angle between (center,vertex) and (center,M) \emph{The environment \tkzNameEnv{tkzelements} uses as \tkzname{lua} the radian as unit for angles. } diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex index 8ecdac344f..feab38af27 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex @@ -18,7 +18,7 @@ The attributes are : \bgroup \catcode`_=12 \small -\captionof{table}{Line attributes.} +\captionof{table}{Line attributes.}\label{line:att} \begin{tabular}{lll} \toprule \textbf{Attributes} & \textbf{Application} & \\ @@ -26,12 +26,12 @@ The attributes are : \Iattr{line}{pb} & Second point of the segment & \\ \Iattr{line}{type} & Type is 'line' & |L.AB.type = 'line'| \\ \Iattr{line}{mid} & Middle of the segment& |z.M = L.AB.mid|\\ -\Iattr{line}{slope} & Slope of the line & obtained with |an = L.AB.slope|\\ -\Iattr{line}{length} & Length of the segment& |l = L.AB.length| \\ -\Iattr{line}{north\_pa} & See next example& d(a,north—pa)=d(a,b)=d(east,b) =etc. \\ +\Iattr{line}{slope} & Slope of the line & see (\ref{ssub:example_class_line})\\ +\Iattr{line}{length} &|l = L.AB.length|&see (\ref{sub:transfer_from_lua_to_tex} ; \ref{ssub:example_class_line})\\ +\Iattr{line}{north\_pa} & See (\ref{ssub:example_class_line}) & \\ \Iattr{line}{north\_pb} & &\\ \Iattr{line}{south\_pa} & &\\ -\Iattr{line}{south\_pb} & &\\ +\Iattr{line}{south\_pb} & &See (\ref{ssub:example_class_line}) \\ \Iattr{line}{east} & &\\ \Iattr{line}{west} & &\\ \bottomrule @@ -76,8 +76,8 @@ z.m = L.ab.mid z.w = L.ab.west z.e = L.ab.east z.r = L.ab.north_pa -z.s = L.ab.south_pb -sl = L.ab.slope +z.s = L.ab.south_pb +sl = L.ab.slope len = L.ab.length \end{tkzelements} \hspace*{\fill} @@ -146,78 +146,433 @@ With | L.AB = line : new (z.A,z.B)|, a line is defined. % subsubsection example_line_attributes (end) % subsection attributes_of_a_line (end) -\clearpage\newpage +\newpage \subsection{Methods of the class line} % (fold) \label{sub:methods_from_class_line} -Here's the list of methods for the \tkzNameObj{line} object. The results are either reals, points, lines, circles or triangles. -\subsubsection{Table of the methods from class line} % (fold) -\label{ssub:table_of_the_methods_from_class_line} +Here's the list of methods for the \tkzNameObj{line} object. The results are either reals, points, lines, circles or triangles. The triangles obtained are similar to the triangles defined below. -\vspace{1em} \begin{minipage}{\textwidth} - \bgroup - \catcode`_=12 - \small - \captionof{table}{Methods of the class line.} - \begin{tabular}{lll} - \toprule - \textbf{Methods} & \textbf{Comments} & \\ - \midrule - \Imeth{line}{new(A, B)} & |L.AB = line : new(z.A,z.B)| line through the points $A$ and $B$&\\ - \midrule - \textbf{Points} &&\\ - \midrule - \Imeth{line}{gold\_ratio ()} & |z.C = L.AB : gold_ratio()| & gold ratio \\ - \Imeth{line}{normalize ()} & |z.C = L.AB : normalize()| & AC =1 and $C\in (AB)$ \\ - \Imeth{line}{normalize\_inv ()} & |z.C = L.AB : normalize_inv()| & CB =1 and $C\in (AB)$ \\ - \Imeth{line}{barycenter (ka,kb)} & |z.C = L.AB : barycenter (1,2)| $C$ & barycenter of |{(A,1)(B,2)}|\\ - \Imeth{line}{point (t)} & |z.C = L.AB : point (2)| & $\overrightarrow{AC} = 2\overrightarrow{AB}$\\ - \Imeth{line}{midpoint ()} & |z.M = L.AB : midpoint ()| & better is |z.M = L.AB.mid| \\ - \Imeth{line}{harmonic\_int } & |z.D = L.AB : harmonic_int (z.C)| & $D\in [AB]$ $C\notin [AB]$\\ - \Imeth{line}{harmonic\_ext (pt)} & |z.D = L.AB : harmonic_ext (z.C)| & $D\notin [AB]$ $C\in [AB]$\\ - \Imeth{line}{harmonic\_both (k)} & |z.C,z.D = L.AB : harmonic_both (tkzphi)| & ${ {CA/CB}={DA/DB}=t\varphi.}$\\ - \Imeth{line}{square ()} & |S.AB =(L.AB : square ()) | & create a square |S.AB|.\footnote{ |_,_,z.C,z.D = get_points(S.AB)|}\\ - \midrule - \textbf{Lines} &&\\ - \midrule - \Imeth{line}{ll\_from ( pt )} & |L.CD = L.AB : ll_from (z.C)| & $(CD) \parallel (AB)$ \\ - \Imeth{line}{ortho\_from ( pt )} & |L.CD = L.AB : ortho_from (z.C)|& $(CD) \perp (AB)$\\ - \Imeth{line}{mediator ()}&|L.uv = L.AB : mediator ()| & $(u,v)$ mediator of $(A,B)$\\ - \midrule - \textbf{Triangles}&&\\ - \midrule - \Imeth{line}{equilateral (swap)} & |T.ABC = L.AB : equilateral ()| $(\overrightarrow{AB},\overrightarrow{AC})>0$ & or < with swap \footnote{Triangles are defined in the direct sense of rotation, unless the "swap" option is present.} \\ - \Imeth{line}{isosceles (phi,swap)} & |T.ABC = L.AB : isosceles (math.pi/6)|& \\ - \Imeth{line}{gold (swap)} & |T.ABC = L.AB : gold ()| & right in $B$ and $AC = \varphi \times AB $ \\ - \Imeth{line}{euclide (swap)} & |T.ABC = L.AB : euclide ()| & $AB=AC$ and $(\overrightarrow{AB},\overrightarrow{AC}) = math.pi/5$ \\ - \Imeth{line}{golden (swap)} & |T.ABC = L.AB : golden ()| & $(\overrightarrow{AB},\overrightarrow{AC}) = 2\times \pi/5$ \\ - \midrule - \textbf{Circles} &&\\ - \midrule - \Imeth{line}{circle ()} & |C.AB = L.AB : circle ()| & center pa through pb \\ - \Imeth{line}{circle\_swap ()} & |C.BA = L.AB : circle\_swap ()|& center pb through pa \\ - \Imeth{line}{apollonius (k)} & |C.apo = L.AB : apollonius (2)|& Ensemble des points tq. |MA/MB = 2| \\ - \midrule - \textbf{Transformations} &&\\ - \midrule - \Imeth{line}{reflection ( obj )} & |new obj = L.AB : reflection (obj|&\\ - \Imeth{line}{translation ( obj )} & |new obj = L.AB : translation (obj)|&\\ - \Imeth{line}{projection ( obj )} & |z.H = L.AB : projection (z.C)| & $CH \perp (AB)$ and $H\in (AB)$\\ - \midrule - \textbf{Miscellaneous} &&\\ - \midrule - \Imeth{line}{distance (pt)} & |d = L.Ab : distance (z.C)| & see \ref{ssub:example_distance_and_projection}\\ - \Imeth{line}{in\_out (pt)} & |b = L.AB: in_out(z.C)| b=true if $C\in (AB)$ &\\ - \Imeth{line}{slope ()} & |a = L.AB : slope()| & better is L.AB.slope \\ - \bottomrule - \end{tabular} - - \egroup +\bgroup +\catcode`_=12 +\small +\captionof{table}{Methods of the class line.(part 1)}\label{line:methods1} +\begin{tabular}{lll} +\toprule +\textbf{Methods} & \textbf{Comments} & \\ +\midrule +\Imeth{line}{new(pt, pt)} & |L.AB = line : new(z.A,z.B)| line $(AB)$& see (\ref{ssub:altshiller})\\ +\midrule +\textbf{Points} &&\\ +\midrule +\Imeth{line}{gold\_ratio ()} & |z.C = L.AB : gold_ratio()| & see (\ref{sub:gold_ratio_with_segment} ; \ref{sub:the_figure_pappus_circle} ; \ref{sub:bankoff_circle}) \\ +\Imeth{line}{normalize ()} & |z.C = L.AB : normalize()| & AC =1 and $C\in (AB)$ see (\ref{ssub:normalize}) \\ +\Imeth{line}{normalize\_inv ()} & |z.C = L.AB : normalize_inv()| & CB =1 and $C\in (AB)$ \\ + \Imeth{line}{barycenter (r,r)} & |z.C = L.AB : barycenter (1,2)| & see (\ref{ssub:barycenter_with_a_line})\\ + \Imeth{line}{point (r)} & |z.C = L.AB : point (2)| & $\overrightarrow{AC} = 2\overrightarrow{AB}$ See (\ref{sub:ellipse} ; \ref{ssub:method_point})\\ +\Imeth{line}{midpoint ()} & |z.M = L.AB : midpoint ()| & better is |z.M = L.AB.mid| \\ +\Imeth{line}{harmonic\_int (pt)} & |z.D = L.AB : harmonic_int (z.C)| & See (\ref{sub:bankoff_circle})\\ +\Imeth{line}{harmonic\_ext (pt)} & |z.D = L.AB : harmonic_ext (z.C)| & See (\ref{sub:bankoff_circle})\\ +\Imeth{line}{harmonic\_both (r)} & |z.C,z.D = L.AB : harmonic_both|($\varphi$) & \ref{sub:harmonic_division_with_tkzphi}\\ +\Imeth{line}{square ()} & |S.AB = L.AB : square () | & create a square |S.AB|.\footnote{ |_,_,z.C,z.D = get_points(S.AB)|}\\ +\midrule +\textbf{Lines} &&\\ +\midrule +\Imeth{line}{ll\_from ( pt )} & |L.CD = L.AB : ll_from (z.C)| & $(CD) \parallel (AB)$ \\ +\Imeth{line}{ortho\_from ( pt )} & |L.CD = L.AB : ortho_from (z.C)|& $(CD) \perp (AB)$\\ +\Imeth{line}{mediator ()}&|L.uv = L.AB : mediator ()| & $(u,v)$ mediator of $(A,B)$\\ +\midrule +\textbf{Triangles}&&\\ +\midrule +\Imeth{line}{equilateral (<swap>)} & |T.ABC = L.AB : equilateral ()| & $(\overrightarrow{AB},\overrightarrow{AC})>0$ or $<0$ with swap \footnote{Triangles are defined in the direct sense of rotation, unless the "swap" option is present.} \\ +\Imeth{line}{isosceles (an<,swap>)} & |T.ABC = L.AB : isosceles (math.pi/6)|& \\ +\Imeth{line}{two\_angles (an,an)} & |T.ABC = L.AB : two_angles (an,an)|¬e \footnote{The given side is between the two angles} see ( ) \\ +\Imeth{line}{school ()} & Angle measurements are 30°,60° and 90°. & \\ +\Imeth{line}{sss (r,r)} & $AC=r$ $BC=r$ & \\ +\Imeth{line}{as (r,an)} & $AC =r$ $\widehat{BAC} = an$& \\ +\Imeth{line}{sa (r,an)} & $AC =r$ $\widehat{ABC} = an$& \\ +\midrule +\textbf{Sacred triangles}&&\\ +\midrule +\Imeth{line}{gold (<swap>)} & |T.ABC = L.AB : gold ()| & right in $B$ and $AC = \varphi \times AB $ \\ +\Imeth{line}{euclide (<swap>)} & |T.ABC = L.AB : euclide ()| & $AB=AC$ and $(\overrightarrow{AB},\overrightarrow{AC}) = \pi/5$ \\ +\Imeth{line}{golden (<swap>)} & |T.ABC = L.AB : golden ()| & + $(\overrightarrow{AB},\overrightarrow{AC}) = 2\times \pi/5$ \\ +\Imeth{line}{divine ()} & & \\ +\Imeth{line}{egyptian ()} & & \\ +\Imeth{line}{cheops ()} & & \\ +\bottomrule +\end{tabular} +\egroup \end{minipage} -% subsubsection table_of_the_methods_from_class_line (end) +\begin{minipage}{\textwidth} +\bgroup +\catcode`_=12 +\small +\captionof{table}{Methods of the class line.(part 2)}\label{line:methods2} +\begin{tabular}{lll} +\toprule +\textbf{Methods} & \textbf{Comments} & \\ +\midrule +\textbf{Circles} &&\\ +\midrule +\Imeth{line}{circle ()} & |C.AB = L.AB : circle ()| & center pa through pb \\ +\Imeth{line}{circle\_swap ()} & |C.BA = L.AB : circle_swap ()|& center pb through pa \\ +\Imeth{line}{apollonius (r)} & |C.apo = L.AB : apollonius (2)|& Ensemble des points tq. |MA/MB = 2| \\ +\midrule +\textbf{Transformations} &&\\ +\midrule +\Imeth{line}{reflection ( obj )} & |new obj = L.AB : reflection (obj|&\\ +\Imeth{line}{translation ( obj )} & |new obj = L.AB : translation (obj)|&\\ +\Imeth{line}{projection ( obj )} & |z.H = L.AB : projection (z.C)| & $CH \perp (AB)$ and $H\in (AB)$\\ +\midrule +\textbf{Miscellaneous} &&\\ +\midrule +\Imeth{line}{distance (pt)} & |d = L.Ab : distance (z.C)| & see \ref{ssub:example_distance_and_projection}\\ +\Imeth{line}{in\_out (pt)} & |b = L.AB: in_out(z.C)| & b=true if $C\in (AB)$ \\ +\Imeth{line}{slope ()} & |a = L.AB : slope()| & better is L.AB.slope \\ +\Imeth{line}{in\_out\_segment (pt)} & |b = L.AB : in_out_segment(z.C)| & b=true if $C\in [AB$] \\ +\bottomrule +\end{tabular} +\egroup +\end{minipage} + +\vspace{1 em} Here are a few examples. +\subsubsection{Triangle with two\_angles} % (fold) +\label{ssub:triangle_with_two__angles} + +The angles are on either side of the given segment + +\begin{minipage}{.4\textwidth} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 4 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : two_angles (math.pi/6,math.pi/2) + z.C = T.ABC.pc +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C) +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} + \begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 4 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC= L.AB : two_angles (math.pi/6,math.pi/2) + z.C = T.ABC.pc + \end{tkzelements} + \hspace*{\fill} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C) + \end{tikzpicture} + \hspace*{\fill} +\end{minipage} +% subsubsection triangle_with_two__angles (end) + +\subsubsection{Triangle with three given sides} % (fold) +\label{ssub:triangle_with_three_given_sides} + +In the following example, a small difficulty arises. The given lengths are not affected by scaling, so it's necessary to use the \Igfct{math}{value (r) } function, which will modify the lengths according to the scale. + +\begin{minipage}{.4\textwidth} +\begin{verbatim} +\begin{tkzelements} + scale =1.25 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : sss (value(3),value(4)) + z.C = T.ABC.pc +\end{tkzelements} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C) +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} + \begin{tkzelements} + scale =1.25 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : sss (value(3),value(4)) + z.C = T.ABC.pc + \end{tkzelements} +\hspace{\fill} \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C) + \end{tikzpicture} +\end{minipage} +% subsubsection triangle_with_three_given_sides (end) + +\subsubsection{Triangle with side between side and angle} % (fold) +\label{ssub:triangle_with_side_between_side_and_angle} + +In some cases, two solutions are possible. + +\begin{minipage}{.4\textwidth} +\begin{verbatim} +\begin{tkzelements} + scale =1.2 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC,T.ABD = L.AB : ssa (value(3),math.pi/6) + z.C = T.ABC.pc + z.D = T.ABD.pc +\end{tkzelements} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C A,B,D) + \tkzDrawPoints(A,B,C,D) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D) + \tkzLabelAngle(C,B,A){$\pi/3$} + \tkzLabelSegment[below left](A,C){$7$} + \tkzLabelSegment[below left](A,D){$7$} +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} + \begin{tkzelements} + scale =1.2 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC,T.ABD = L.AB : ssa (value(3),math.pi/6) + z.C = T.ABC.pc + z.D = T.ABD.pc + \end{tkzelements} + \hspace{\fill} \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C A,B,D) + \tkzDrawPoints(A,B,C,D) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D) + \tkzLabelAngle(C,B,A){$\pi/3$} + \tkzLabelSegment[below left](A,C){$7$} + \tkzLabelSegment[below left](A,D){$7$} + \end{tikzpicture} +\end{minipage} + +% subsubsection triangle_with_side_between_side_and_angle (end) + +\subsubsection{About sacred triangles} % (fold) +\label{ssub:about_triangles} +The side lengths are proportional to the lengths given in the table. They depend on the length of the initial segment. + +\captionof{table}{Sacred triangles.}\label{line:met} +\begin{tabular}{ll} +\toprule +\textbf{Name} & \textbf{definition} \\ +\midrule +\Imeth{line}{gold (<swap>)} & Right triangle with $a=\varphi$, $b=1$ and $c=\sqrt{\varphi}$\\ +\Imeth{line}{golden (<swap>)} &Right triangle $b=\varphi$ $c=1$ ; half of gold rectangle \\ +\Imeth{line}{divine ()} & Isosceles $a=\varphi$, $b=c=1$ and $\beta = \gamma=\pi/5$ \\ +\Imeth{line}{pythagoras ()} & $a=5$, $b=4$, $c=3$ and other names: isis or egyptian\\ +\Imeth{line}{sublime ()} & Isosceles $a=1$, $b=c=\varphi$ and $\beta =\gamma=2\pi/5$ ; other name: euclid\\ +\Imeth{line}{cheops ()} & Isosceles $a=2$, $b=c=\varphi$ and height = $\sqrt{\varphi}$ \\ +\bottomrule +\end{tabular} + +\begin{minipage}{.4\textwidth} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 4 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : cheops () + z.C = T.ABC.pc + T.ABD = L.AB : gold () + z.D = T.ABD.pc + T.ABE = L.AB : euclide () + z.E = T.ABE.pc + T.ABF = L.AB : golden () + z.F = T.ABF.pc + T.ABG = L.AB : devine () + z.G = T.ABG.pc + T.ABH = L.AB : pythagoras () + z.H = T.ABH.pc +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H) + \tkzDrawPoints(A,...,H) + \tkzLabelPoints(A,...,H) +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} +\begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 4 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : cheops () + z.C = T.ABC.pc + T.ABD = L.AB : gold () + z.D = T.ABD.pc + T.ABE = L.AB : euclide () + z.E = T.ABE.pc + T.ABF = L.AB : golden () + z.F = T.ABF.pc + T.ABG = L.AB : divine () + z.G = T.ABG.pc + T.ABH = L.AB : pythagoras () + z.H = T.ABH.pc +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H) + \tkzDrawPoints(A,...,H) + \tkzLabelPoints(A,...,H) +\end{tikzpicture} +\end{minipage} +% subsubsection about_triangles (end) + +\subsubsection{Method point }% (fold) +\label{ssub:method_point} +This method is very useful. It allows you to place a point on the line under consideration. +If |r = 0| then the point is |pa|, if |r = 1| it's |pb|. + +If |r = .5| the point obtained is the midpoint of the segment. |r| can be negative or greater than 1. + +This method exists for all objects except quadrilaterals. + + +\begin{minipage}{.4\textwidth} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new (-1,-1) + z.B = point : new (1,1) + L.AB = line : new (z.A,z.B) + z.I = L.AB : point (0.5) + z.J = L.AB : point (-0.5) + z.K = L.AB : point (2) +\end{tkzelements} +\begin{tikzpicture}[gridded] +\tkzGetNodes + \tkzDrawLine(J,K) + \tkzDrawPoints(A,B,I,J,K) + \tkzLabelPoints(A,B,I,J,K) + \end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} + \begin{tkzelements} + z.A = point : new (-1,-1) + z.B = point : new (1,1) + L.AB = line : new (z.A,z.B) + z.I = L.AB : point (0.5) + z.J = L.AB : point (-0.5) + z.K = L.AB : point (2) +\end{tkzelements} +\begin{tikzpicture}[gridded] +\tkzGetNodes + \tkzDrawLine(J,K) + \tkzDrawPoints(A,B,I,J,K) + \tkzLabelPoints(A,B,I,J,K) + \end{tikzpicture} + \end{minipage} +% subsubsection method_point (end) + +\subsubsection{Normalize} % (fold) +\label{ssub:normalize} + + +\begin{minipage}{.4\textwidth} + \begin{verbatim} + \begin{tkzelements} + z.a = point: new (1, 1) + z.b = point: new (5, 4) + L.ab = line : new (z.a,z.b) + z.c = L.ab : normalize () + \end{tkzelements} + + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawSegments(a,b) + \tkzDrawCircle(a,c) + \tkzDrawPoints(a,b,c) + \tkzLabelPoints(a,b,c) + \end{tikzpicture} + \end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} +\begin{tkzelements} + z.a = point: new (1, 1) + z.b = point: new (5, 4) + L.ab = line : new (z.a,z.b) + z.c = L.ab : normalize () +\end{tkzelements} +\hspace*{\fill} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawSegments(a,b) +\tkzDrawCircle(a,c) +\tkzDrawPoints(a,b,c) +\tkzLabelPoints(a,b,c) +\end{tikzpicture} +\hspace*{\fill} +\end{minipage} +% subsubsection normalize (end) + + +\subsubsection{Barycenter with a line} % (fold) +\label{ssub:barycenter_with_a_line} + +\begin{minipage}{.4\textwidth} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 0 , -1 ) + z.B = point : new ( 4 , 2 ) + L.AB = line : new ( z.A , z.B ) + z.G = L.AB : barycenter (1,2) +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPoints(A,B,G) + \tkzLabelPoints(A,B,G) +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} +\begin{tkzelements} + z.A = point : new ( 0 , -1 ) + z.B = point : new ( 4 , 2 ) + L.AB = line : new ( z.A , z.B ) + z.G = L.AB : barycenter (1,2) +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPoints(A,B,G) + \tkzLabelPoints(A,B,G) +\end{tikzpicture} +\end{minipage} +% subsubsection barycenter_with_a_line (end) + \subsubsection{Example: new line from a defined line} % (fold) \label{ssub:new_line_from_a_defined_line} \begin{minipage}{0.5\textwidth} @@ -520,6 +875,33 @@ z.a,z.b = L.ab.pa,L.ab.pb \subsection{Apollonius circle MA/MB = k} % (fold) \label{sub:apollonius_circle_ma_mb_k} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 6 , 0 ) + L.AB =line: new (z.A,z.B) + C.apo = L.AB : apollonius (2) + z.O,z.C = get_points ( C.apo ) + z.D = C.apo : antipode (z.C) + z.P = C.apo : point (0.30) +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzFillCircle[blue!20,opacity=.2](O,C) + \tkzDrawCircle[blue!50!black](O,C) + \tkzDrawPoints(A,B,O,C,D,P) + \tkzLabelPoints[below right](A,B,O,C,D,P) + \tkzDrawSegments[orange](P,A P,B P,D B,D P,C) + \tkzDrawSegments[red](A,C) + \tkzDrawPoints(A,B) + \tkzLabelCircle[draw,fill=green!10,% + text width=3cm,text centered,left=24pt](O,D)(60)% + {$CA/CB=2$\\$PA/PB=2$\\$DA/DB=2$} + \tkzMarkRightAngle[opacity=.3,fill=lightgray](O,P,C) + \tkzMarkAngles[mark=||](A,P,D D,P,B) +\end{tikzpicture} +\end{verbatim} + \begin{tkzelements} z.A = point : new ( 0 , 0 ) z.B = point : new ( 6 , 0 ) @@ -546,7 +928,7 @@ z.P = C.apo : point (0.30) \tkzMarkAngles[mark=||](A,P,D D,P,B) \end{tikzpicture} -Remark: |\tkzUseLua{point.mod(z.P-z.A)/point.mod(z.P-z.B)}| = \tkzUseLua{point.mod(z.P-z.A)/point.mod(z.P-z.B)} +Remark: |\tkzUseLua{length(z.P,z.A)/length(z.P,z.B)}| = \tkzUseLua{length(z.P,z.A)/length(z.P,z.B)} % subsection apollonius_circle_ma_mb_k (end) % subsection methods_from_class_line (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex index 017e3ae2d4..d0867da269 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex @@ -5,7 +5,7 @@ \bgroup \catcode`_=12 \small -\captionof{table}{Math constants and functions.} +\captionof{table}{Math constants and functions.}\label{misc} \begin{tabular}{ll} \toprule \textbf{contants or functions} & \textbf{Comments}\\ @@ -17,21 +17,31 @@ %tkzround( num, idp ) & \\ % Cramer33(a1,a2,a3,b1,b2,b3,c1,c2,c3) & \\ % Cramer22(a1,a2,b1,b2) & \\ +\Igfct{math}{length (a,b) } & point.abs(a-b) See (\ref{ssub:report_de_distance}) \\ \Igfct{math}{islinear (z1,z2,z3) } & Are the points aligned? (z2-z1) $\parallel$ (z3-z1) ? \\ \Igfct{math}{isortho (z1,z2,z3)} & (z2-z1) $\perp$ (z3-z1) ? boolean\\ +\Igfct{math}{get\_angle (z1,z2,z3)} & the vertex is z1 See (\ref{sub:get_angle}) \\ +\Igfct{math}{bisector (z1,z2,z3)} & L.Aa = bisector (z.A,z.B,z.C) from A (\ref{sub:get_angle})\\ +\Igfct{math}{bisector\_ext (z1,z2,z3)} & L.Aa = bisector_ext (z.A,z.B,z.C) from A \\ +\Igfct{math}{altitude (z1,z2,z3)} & altitude from z1 \\ \Igfct{package}{set\_lua\_to\_tex (list)} & set\_lua\_to\_tex('a','n') defines |\a| and |\n| \\ \Igfct{package}{tkzUseLua (variable)} & |\textbackslash\tkzUseLua{a}| prints the value of a\\ %parabola (a,b,c) & to get \\ \Igfct{math}{value (v) } & apply |scale * value | \\ \Igfct{math}{real (v) } & apply | value /scale | \\ -\Igfct{math}{angle\_normalize (a) } & to get a value between 0 and $2\pi$ \\ -\Igfct{misc}{radical\_center (C1,C2,C3)} & see \ref{sub:radical_center} \\ -\Igfct{misc}{radical\_circle (C1,C2,C3)} & see \ref{sub:radical_circle} \\ +\Igfct{math}{angle\_normalize (an) } & to get a value between 0 and $2\pi$ \\ \Igfct{misc}{barycenter (\{z1,n1\},\{z2,n2\}, ...)} & barycenter of list of points \\ \bottomrule \end{tabular} \egroup +\subsection{Length of a segment} % (fold) +\label{sub:length_of_a_segment} +|length(z.A,z.B)| is a shortcut for |point.abs(z.A-z.B)|. This avoids the need to use complexes. + +% subsection length_of_a_segment (end) + + \subsection{Harmonic division with tkzphi } % (fold) \label{sub:harmonic_division_with_tkzphi} \begin{tkzexample}[latex=0cm,small,code only] @@ -111,7 +121,7 @@ % subsection function_islinear (end) -\subsection{Function \tkzfname{value} }% (fold) +\subsection{Function value }% (fold) \label{sub:function_value} value to apply scaling if necessary @@ -120,7 +130,7 @@ If |scale = 1.2| with a = value(5) the actual value of |a| will be $5\times 1.2 % subsubsection function_value (end) -\subsubsection{Function \tkzfname{real} }% (fold) +\subsubsection{Function real }% (fold) \label{ssub:function_real} If |scale = 1.2| with a = 6 then real(a) = $6 / 1.2 = 5$ . @@ -135,44 +145,44 @@ It's possible to transfer variable from Lua to \TEX{} with \begin{minipage}{.5\textwidth} - \begin{verbatim} - \begin{tkzelements} - z.A = point : new (0 , 0) - z.B = point : new (4 , 3) - z.C = point : new (2 , 5) - L.AB = line : new (z.A,z.B) - d = L.AB : distance (z.C) - l = L.AB.length - z.H = L.AB : projection (z.C) - \end{tkzelements} - % possible here \tkzUseLua{L.AB.length} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawLines(A,B C,H) - \tkzDrawPoints(A,B,C,H) - \tkzLabelPoints(A,B,C,H) - \tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} - \tkzLabelSegment[below left,draw](C,H){$AB = \tkzUseLua{l}$} - \end{tikzpicture} - \end{verbatim} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new (0 , 0) + z.B = point : new (3 , 2) + z.C = point : new (2 , 5) + L.AB = line : new (z.A,z.B) + d = L.AB : distance (z.C) + l = L.AB.length + z.H = L.AB : projection (z.C) +\end{tkzelements} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B C,H) +\tkzDrawPoints(A,B,C,H) +\tkzLabelPoints(A,B,C,H) +\tkzLabelSegment[above right,draw](C,H){$CH = \tkzUseLua{d}$} +\tkzLabelSegment[below right,draw](A,B){$AB = \tkzUseLua{l}$} +\end{tikzpicture} +\end{verbatim} \end{minipage} \begin{minipage}{.5\textwidth} \begin{tkzelements} z.A = point : new (0 , 0) - z.B = point : new (4 , 3) + z.B = point : new (3 , 2) z.C = point : new (2 , 5) L.AB = line : new (z.A,z.B) d = L.AB : distance (z.C) l = L.AB.length z.H = L.AB : projection (z.C) \end{tkzelements} + \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,H) \tkzDrawPoints(A,B,C,H) \tkzLabelPoints(A,B,C,H) -\tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} -\tkzLabelSegment[below left,draw](C,H){$AB = \tkzUseLua{l}$} +\tkzLabelSegment[above right,draw](C,H){$CH = \tkzUseLua{d}$} +\tkzLabelSegment[below right,draw](A,B){$AB = \tkzUseLua{l}$} \end{tikzpicture} \end{minipage} % subsection transfer_from_lua_to_tex (end) @@ -280,7 +290,6 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \end{tikzpicture} \hspace*{\fill} \end{minipage} - % subsection get_angle (end) \subsection{Dot or scalar product} % (fold) @@ -343,59 +352,71 @@ With the functions |islinear| and |isortho|. |islinear(z.a,z.b,z.c)| gives |true |isortho(z.a,z.b,z.c)| gives |true| if the line $(ab)$ is orthogonal to the line $(ac)$. % subsection alignment_or_orthogonality (end) +\subsection{Bisector and altitude} % (fold) +\label{sub:bisector_and_altitude} +These functions are useful if you don't need to create a useful triangle object for the rest of your code. + +\begin{minipage}{.5\textwidth} + \begin{verbatim} +\begin{tkzelements} + z.a = point: new (0, 0) + z.b = point: new (5, -2) + z.c = point: new (2, 3) + z.i = bisector (z.a,z.c,z.b).pb + z.h = altitude (z.b,z.a,z.c).pb + angic = tkzround ( get_angle (z.a,z.i,z.c),2) + angci = tkzround ( get_angle (z.a,z.b,z.i),2) + z.e = bisector_ext (z.a,z.b,z.c).pb +\end{tkzelements} + +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(a,b,c) + \tkzDrawSegments(a,i b,h a,e) + \tkzDrawPoints(a,b,c,i,h) + \tkzLabelPoints(a,b) + \tkzLabelPoints[above](c,i,h) + \tkzMarkAngle[->](i,a,c) + \tkzLabelAngle[font=\tiny,pos=.75](i,a,c){\tkzUseLua{angci}} + \tkzMarkAngle[<-](b,a,i) + \tkzLabelAngle[font=\tiny,pos=.75](b,a,i){\tkzUseLua{angic}} +\end{tikzpicture} + \end{verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\begin{tkzelements} + z.a = point: new (0, 0) + z.b = point: new (5, -2) + z.c = point: new (2, 3) + z.i = bisector (z.a,z.c,z.b).pb + z.h = altitude (z.b,z.a,z.c).pb + angic = tkzround ( get_angle (z.a,z.i,z.c),2) + angci = tkzround ( get_angle (z.a,z.b,z.i),2) + z.e = bisector_ext (z.a,z.b,z.c).pb +\end{tkzelements} +\hspace{\fill} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(a,b,c) + \tkzDrawSegments(a,i b,h a,e) + \tkzDrawPoints(a,b,c,i,h) + \tkzLabelPoints(a,b) + \tkzLabelPoints[above](c,i,h) + \tkzMarkAngle[->](i,a,c) + \tkzLabelAngle[font=\tiny,pos=.75](i,a,c){\tkzUseLua{angci}} + \tkzMarkAngle[<-](b,a,i) + \tkzLabelAngle[font=\tiny,pos=.75](b,a,i){\tkzUseLua{angic}} +\end{tikzpicture} +\end{minipage} +% subsection bisector_and_altitude (end) + \subsection{Other functions} % (fold) \label{sub:other_functions} Not documented because still in beta version: |parabola|, |Cramer22|, |Cramer33|. % subsection other_functions (end) - % section math_functions (end) -% % section classes_and_objects (end) -\endinput - - +\endinput -% \bgroup -% \catcode`_=12 -% \begin{table}[H] -% \small -% \begin{center} -% \caption{functions\_polygons.lua } -% \begin{tabular}{lll} -% \toprule -% \textbf{Functions} & \textbf{Comments}\\ -% \midrule -% function square (a,b) \\ -% function parallelogram (a,b,c) \\ -% \bottomrule -% \end{tabular} -% \end{center} -% \end{table} -% \egroup - - -% \bgroup -% \catcode`_=12 -% \begin{table}[H] -% \small -% \begin{center} -% \caption{elements\_vectors.lua } -% \begin{tabular}{lll} -% \toprule -% \textbf{Methods} & \textbf{Comments}\\ -% \midrule -% vector = {} class vector \\ -% \Imeth{vector}{function vector: new (z1,z2)} & st, ed \\ -% \Imeth{vector}{function vector: normalize ()} &\\ -% \bottomrule -% \end{tabular} -% \end{center} -% \end{table} -% \egroup - - - - -\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex index 2b4a165a28..e818cdece0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex @@ -14,7 +14,7 @@ Creation | P.new = parallelogram : new (z.A,z.B,z.C,z.D)| \bgroup \catcode`_=12 \small -\captionof{table}{Parallelogram attributes.} +\captionof{table}{Parallelogram attributes.}\label{parallelogram:att} \begin{tabular}{lll} \toprule \textbf{Attributes} & \textbf{Application} & \\ @@ -93,7 +93,7 @@ z.I = P.new.center \bgroup \catcode`_=12 \small -\captionof{table}{Parallelogram methods.} +\captionof{table}{Parallelogram methods.}\label{parallelogram:met} \begin{tabular}{ll} \toprule \textbf{Methods} & \textbf{Comments} \\ diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex index ef9ddbfc76..45f7991c92 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex @@ -97,15 +97,15 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name \bgroup \small \catcode`_=12 -\captionof{table}{Point attributes.} +\captionof{table}{Point attributes.}\label{point:att} \begin{tabular}{lll} \toprule -\textbf{Attributes} & \textbf{Application}\\ -\Iattr{point}{re} & |z.A.re| &\tkzar |z.A = point:new (1,2) x = z.A.re|=1\\ -\Iattr{point}{im} & |z.A.im| &\tkzar |z.A = point:new (1,2) y= z.A.im|=2\\ -\Iattr{point}{type} & |z.A.type| &\tkzar |z.A.type = 'point'|\\ -\Iattr{point}{argument} & |z.A.argument| &\tkzar |z.A.argument $\approx$ 0.78539816339745|\\ -\Iattr{point}{module} & |z.A.module| &\tkzar |z.A.module| $\approx$ |2.2360...| =$\sqrt{5}$\\ +\textbf{Attributes} & \textbf{Application}& \textbf{Example}\\ +\Iattr{point}{re} & |z.A.re = 1| & see (\ref{ssub:methods}) \\ +\Iattr{point}{im} & |z.A.im = 2| &see (\ref{ssub:methods}) \\ +\Iattr{point}{type} & |z.A.type = 'point| & \\ +\Iattr{point}{argument} & |z.A.argument $\approx$ 0.78539816339745| & see (\ref{ssub:example_point_attributes})\\ +\Iattr{point}{module} & |z.A.module| $\approx$ |2.2360...| =$\sqrt{5}$ & see (\ref{ssub:example_point_attributes})\\ \bottomrule \end{tabular} \egroup @@ -126,13 +126,13 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name \end{tkzelements} \end{verbatim} \pgfkeys{/pgf/number format/.cd,std,precision=2} -\let\pmpn\pgfmathprintnumber +\let\pmpn\pgfmathprintnumber \DeleteShortVerb{\|} \begin{verbatim} \begin{tikzpicture}[scale = 1] \pgfkeys{/pgf/number format/.cd,std,precision=2} -\let\pmpn\pgfmathprintnumber +\let\pmpn\pgfmathprintnumber \tkzDefPoints{2/4/M,2/0/A,0/0/O,0/4/B} \tkzLabelPoints(O) \tkzMarkAngle[fill=gray!30,size=1](A,O,M) @@ -154,7 +154,7 @@ $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm} \begin{center} \begin{tikzpicture} \pgfkeys{/pgf/number format/.cd,std,precision=2} - \let\pmpn\pgfmathprintnumber + \let\pmpn\pgfmathprintnumber \tkzDefPoints{2/4/M,2/0/A,0/0/O,0/4/B} \tkzLabelPoints(O) \tkzMarkAngle[fill=gray!30,size=1](A,O,M) @@ -172,7 +172,7 @@ $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm} \begin{scope}[every annotation/.style={fill=lightgray!15,anchor = east}] \node [annotation,font =\small,text width=6cm] at (current bounding box.west) { Attributes of \texttt{z.M} - \begin{itemize} + \begin{itemize} \item \texttt{z.M.re} = 1 \item \texttt{z.M.im} = 2 \item \texttt{z.M.type} = 'point' @@ -184,7 +184,7 @@ Attributes of \texttt{z.M} \end{tikzpicture} \end{center} -\MakeShortVerb{\|} + \MakeShortVerb{\|} \hspace*{\fill} % \caption{Class Point} % subsubsection example_point_attributes (end) @@ -192,13 +192,13 @@ Attributes of \texttt{z.M} \subsubsection{Argand diagram} % (fold) \label{ssub:argand_diagram} -\normalsize +\normalsize \begin{minipage}{\textwidth} \begin{verbatim} \begin{tkzelements} z.A = point : new ( 2 , 3 ) - z.O = point : new ( 0 , 0 ) - z.I = point : new ( 1 , 0 ) + z.O = point : new ( 0 , 0 ) + z.I = point : new ( 1 , 0 ) \end{tkzelements} \hspace{\fill}\begin{tikzpicture} \tkzGetNodes @@ -218,8 +218,8 @@ Attributes of \texttt{z.M} \begin{minipage}{\textwidth} \begin{tkzelements} z.A = point : new ( 2 , 3 ) - z.O = point : new ( 0 , 0 ) - z.I = point : new ( 1 , 0 ) + z.O = point : new ( 0 , 0 ) + z.I = point : new ( 1 , 0 ) \end{tkzelements} \hspace{\fill}\begin{tikzpicture} \tkzGetNodes @@ -242,53 +242,54 @@ Attributes of \texttt{z.M} \subsection{Methods of the class point} % (fold) \label{sub:methods_of_the_class_point} -The methods described in the following table are standard. You'll find them in most of the examples at the end of this documentation. The result of the different methods presented in the following table is a \tkzNameObj{point}. +The methods described in the following table are standard. You'll find them in most of the examples at the end of this documentation. The result of the different methods presented in the following table is a \tkzNameObj{point}. \vspace{1em} \bgroup \catcode`_=12 \small -\captionof{table}{Methods of the class point.} -\begin{tabular}{lll} -\toprule -\textbf{Methods} & \textbf{Application}& \\ +\captionof{table}{Methods of the class point.}\label{point:met} +\begin{tabular}{lll} +\toprule +\textbf{Methods} & \textbf{Application}& \\ +\midrule +\Imeth{point}{new(r, r)} & |z.A = point : new(1,2)| & see (\ref{ssub:method_normalize}) \\ +\Imeth{point}{polar (d, an)} & |z.A = point : polar(1,math.pi/3)| & see (\ref{sub:archimedes} )\\ +\Imeth{point}{polar\_deg an} & an in deg & polar coordinates an deg \\ \midrule - new (a,b) & |z.a = point : new(1,2)| &\tkzar affix z.a=1+2i \\ - polar (radius, phi) & |z.a = point : polar(1,math.pi/3)| &\tkzar affix $cos(\pi/3)+sin(\pi/3)i$ \\ - polar_deg (radius, phi) & phi in deg &\tkzar polar coordinates phi deg \\ -\midrule - \textbf{Points} &&\\ -\midrule - north(d) & see \ref{sub:power_v2} |d| distance to the point & d=1 1 if empty \\ - south(d) & \\ - east(d) & \\ - west(d) & \\ - normalize() & |z.b = z.a: normalize ()| &\tkzar |z.b| = 1 and z.a = k$\times$ z.b \\ - get_points (obj) & retrieves points from the object & \\ - \midrule +\textbf{Points} &&\\ +\midrule +\Imeth{point}{north(r)} & |r| distance to the point (1 if empty) & see (\ref{sub:power_v2}) ; \ref{ssub:methods}) \\ +\Imeth{point}{south(r)} & & \\ +\Imeth{point}{east(r)} & & \\ +\Imeth{point}{west(r)} & & \\ +\Imeth{point}{normalize()} & |z.b = z.a: normalize ()| & see (\ref{ssub:method_normalize}) \\ +\Imeth{point}{get\_points (obj)} & retrieves points from the object & \\ + \midrule \textbf{Transformations} &&\\ \midrule - symmetry(obj) & obj : point,line,etc. &\tkzar z.a:symmetry (C.OH) \\ - rotation(angle , obj) & point,line,etc. &\tkzar rotation center a\\ - homothety(k,obj) & |z.c = z.a : homothety (2,z.b)| & \\ -\bottomrule % + \Imeth{point}{symmetry(obj)} & obj : point, line, etc. & see (\ref{ssub:object_symmetry}) \\ + \Imeth{point}{rotation(an , obj)} & point, line, etc. & see (\ref{ssub:object_rotation})\\ + \Imeth{point}{homothety(r,obj)} & |z.c = z.a : homothety (2,z.b)| & see (\ref{sub:homothety}) \\ +\bottomrule % \end{tabular} \egroup \subsubsection{Example: method \Imeth{point}{north (d)} } % (fold) \label{ssub:example_method_imeth_point_north_d} +This function defines a point located on a vertical line passing through the given point. This function is useful if you want to report a certain distance (see the following example). If |d| is absent then it is considered equal to 1. \begin{minipage}{.5\textwidth} \begin{verbatim} \begin{tkzelements} - z.O = point : new ( 0, 0 ) - z.A = z.O : east () - z.Ap = z.O : east (2) : north (2) - z.B = z.O : north () - z.C = z.O : west () - z.D = z.O : south () + z.O = point : new ( 0, 0 ) + z.A = z.O : east () + z.Ap = z.O : east (2) : north (2) + z.B = z.O : north () + z.C = z.O : west () + z.D = z.O : south () \end{tkzelements} \begin{tikzpicture} \tkzGetNodes @@ -300,12 +301,12 @@ If |d| is absent then it is considered equal to 1. \begin{minipage}{.5\textwidth} \begin{tkzelements} scale = 1.5 - z.O = point : new ( 0, 0 ) - z.A = z.O : east () + z.O = point : new ( 0, 0 ) + z.A = z.O : east () z.Ap = z.O : east (2) : north (2) - z.B = z.O : north () - z.C = z.O : west () - z.D = z.O : south () + z.B = z.O : north () + z.C = z.O : west () + z.D = z.O : south () \end{tkzelements} \hspace{\fill} \begin{tikzpicture} @@ -317,8 +318,66 @@ If |d| is absent then it is considered equal to 1. \end{minipage} % subsubsection example_method_imeth_point_north_d (end) + +\subsubsection{Length transfer} % (fold) +\label{ssub:report_de_distance} + +Use of |north and east| functions linked to points, to transfer lengths, see (\ref{sub:length_of_a_segment}) + +\begin{minipage}{.4\textwidth} +\begin{verbatim} +\begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 3 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : sublime () + z.C = T.ABC.pc + z.D = z.B: north (length(z.B,z.C)) + z.E = z.B: east (L.AB.length) + z.M = L.AB.mid + z.F = z.E : north (length(z.C,z.M)) +\end{tkzelements} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawSegments[gray,dashed](B,D B,E E,F C,M) + \tkzDrawPoints(A,...,F) + \tkzLabelPoints(A,B,E,M) + \tkzLabelPoints[above right](C,D,F) +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} +\begin{tkzelements} + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 3 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : sublime () + z.C = T.ABC.pc + z.D = z.B: north (length(z.B,z.C)) + z.E = z.B: east (L.AB.length) + z.M = L.AB.mid + z.F = z.E : north (length(z.C,z.M)) +\end{tkzelements} +\hspace{\fill} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawSegments[gray,dashed](B,D B,E E,F C,M) + \tkzDrawPoints(A,...,F) + \tkzLabelPoints(A,B,E,M) + \tkzLabelPoints[above right](C,D,F) +\end{tikzpicture} +\end{minipage} + +% subsubsection report_de_distance (end) + + \subsubsection{Example: method \Imeth{point}{polar} } % (fold) \label{ssub:example_polar_method} + +This involves defining a point using its modulus and argument. + \begin{minipage}{0.6\textwidth} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} @@ -327,7 +386,7 @@ If |d| is absent then it is considered equal to 1. z.F = point: polar (3, math.pi/3) \end{tkzelements} \begin{tikzpicture} - \tkzGetNodes + \tkzGetNodes \tkzDrawCircle(O,A) \tkzDrawSegments[new](O,A) \tkzDrawSegments[purple](O,F) @@ -345,7 +404,7 @@ If |d| is absent then it is considered equal to 1. \end{tkzelements} \hspace*{\fill} \begin{tikzpicture} -\tkzGetNodes +\tkzGetNodes \tkzDrawCircle(O,A) \tkzDrawSegments[new](O,A) \tkzDrawSegments[purple](O,F) @@ -356,8 +415,57 @@ If |d| is absent then it is considered equal to 1. \end{minipage} % subsubsection example_polar_method (end) -\subsubsection{Example: rotation of points} % (fold) +\subsubsection{Method \Imeth{point}{normalize ()}} % (fold) +\label{ssub:method_normalize} + +The result is a point located between the origin and the initial point at a distance of $1$ from the origin. + +\begin{minipage}{.4\textwidth} +\begin{verbatim} +\begin{tkzelements} + scale = 1.5 + z.O = point : new (0,0) + z.A = point : new (1,2) + z.B = z.A : normalize () + z.I = point : new (1,0) +\end{tkzelements} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawSegment(O,A) + \tkzDrawCircle(O,B) + \tkzDrawPoints(O,A,B,I) + \tkzLabelPoints(O,A,B) + \tkzLabelPoint[below right](I){$1$} +\end{tikzpicture} +\end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} +\begin{tkzelements} +scale = 1.5 +z.O = point : new (0,0) +z.A = point : new (1,2) +z.B = z.A : normalize () +z.I = point : new (1,0) +\end{tkzelements} + \hspace*{\fill} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawSegment(O,A) +\tkzDrawCircle(O,B) +\tkzDrawPoints(O,A,B,I) +\tkzLabelPoints(O,A,B) +\tkzLabelPoint[below right](I){$1$} +\end{tikzpicture} + \hspace*{\fill} +\end{minipage} +% subsubsection method_normalize (end) + + +\subsubsection{Example: \Imeth{point}{rotation of points}} % (fold) \label{ssub:example_rotation_of_points} + +The arguments are the angle of rotation in radians, and here a list of points. + \begin{minipage}{.6\textwidth} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} @@ -398,25 +506,25 @@ If |d| is absent then it is considered equal to 1. \end{minipage} % subsubsection example_rotation_of_points (end) -\subsubsection{Object rotation} % (fold) +\subsubsection{Object \Imeth{point}{rotation}} % (fold) \label{ssub:object_rotation} Rotate a triangle by an angle of $\pi/6$ around $O$. \begin{minipage}{.5\textwidth} \begin{verbatim} \begin{tkzelements} -z.O = point : new ( -1 , -1 ) -z.A = point : new ( 2 , 0 ) -z.B = point : new ( 5 , 0 ) -L.AB = line : new (z.A,z.B) -T.ABC = L.AB : equilateral () -S.fig = L.AB : square () -_,_,z.E,z.F = get_points ( S.fig ) -S.new = z.O : rotation (math.pi/3,S.fig) -_,_,z.Ep,z.Fp = get_points ( S.new ) -z.C = T.ABC.pc -T.ApBpCp = z.O : rotation (math.pi/3,T.ABC) -z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) + z.O = point : new ( -1 , -1 ) + z.A = point : new ( 2 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new (z.A,z.B) + T.ABC = L.AB : equilateral () + S.fig = L.AB : square () + _,_,z.E,z.F = get_points ( S.fig ) + S.new = z.O : rotation (math.pi/3,S.fig) + _,_,z.Ep,z.Fp = get_points ( S.new ) + z.C = T.ABC.pc + T.ApBpCp = z.O : rotation (math.pi/3,T.ABC) + z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) \end{tkzelements} \begin{tikzpicture} @@ -430,18 +538,18 @@ z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) \end{minipage} \begin{minipage}{.5\textwidth} \begin{tkzelements} -z.O = point : new ( -1 , -1 ) -z.A = point : new ( 2 , 0 ) -z.B = point : new ( 5 , 0 ) +z.O = point : new ( -1 , -1 ) +z.A = point : new ( 2 , 0 ) +z.B = point : new ( 5 , 0 ) L.AB = line : new (z.A,z.B) T.ABC = L.AB : equilateral () S.fig = L.AB : square () -_,_,z.E,z.F = get_points ( S.fig ) +_,_,z.E,z.F = get_points ( S.fig ) S.new = z.O : rotation (math.pi/3,S.fig) -_,_,z.Ep,z.Fp = get_points ( S.new ) +_,_,z.Ep,z.Fp = get_points ( S.new ) z.C = T.ABC.pc T.ApBpCp = z.O : rotation (math.pi/3,T.ABC) -z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) +z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) \end{tkzelements} \hspace{\fill}\begin{tikzpicture} @@ -453,12 +561,12 @@ z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) \tkzDrawArc[delta=0,->,dashed,red](O,A)(A') \tkzDrawSegments[dashed,red](O,A O,A') \end{scope} - + \end{tikzpicture} \end{minipage} % subsubsection object_rotation (end) -\subsubsection{Object symmetry} % (fold) +\subsubsection{Object \Imeth{point}{symmetry}} % (fold) \label{ssub:object_symmetry} \begin{minipage}{.5\textwidth} \begin{verbatim} @@ -470,7 +578,7 @@ z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) z.o = point: new(1,1) z.ap,z.bp = get_points (z.o: symmetry (C.ab)) \end{tkzelements} - + \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(a,b a',b') @@ -490,7 +598,7 @@ z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) z.o = point: new(1, 1) z.ap,z.bp = get_points (z.o: symmetry (C.ab)) \end{tkzelements} - + \hspace{\fill}\begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(a,b a',b') @@ -502,5 +610,6 @@ z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) \end{minipage} % subsubsection object_symmetry (end) % subsection methods_of_the_class_point (end) + % section class_point (end) \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex index 2171337792..8b777de57b 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex @@ -13,7 +13,7 @@ Creation | Q.new = rectangle : new (z.A,z.B,z.C,z.D)| \bgroup \catcode`_=12 \small -\captionof{table}{rectangle attributes.} +\captionof{table}{rectangle attributes.}\label{quadrilateral:att} \begin{tabular}{lll} \toprule \textbf{Attributes} & \textbf{Application} & \\ @@ -88,7 +88,7 @@ z.G = Q.ABCD.g \bgroup \catcode`_=12 \small -\captionof{table}{Quadrilateral methods.} +\captionof{table}{Quadrilateral methods.}\label{quadrilateral:met} \begin{tabular}{ll} \toprule \textbf{Methods} & \textbf{Comments} \\ diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex index 418278a99f..8b591cc61e 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex @@ -14,7 +14,7 @@ Creation | R.ABCD = rectangle : new (z.A,z.B,z.C,z.D)| \bgroup \catcode`_=12 \small -\captionof{table}{rectangle attributes.} +\captionof{table}{rectangle attributes.}\label{rectangle:att} \begin{tabular}{lll} \toprule \textbf{Attributes} & \textbf{Application} & \\ @@ -95,7 +95,7 @@ z.I = R.new.center \bgroup \catcode`_=12 \small -\captionof{table}{Rectangle methods.} +\captionof{table}{Rectangle methods.}\label{rectangle:met} \begin{tabular}{lll} \toprule \textbf{Methods} & \textbf{Comments} & \\ diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex index 4a25afdfe5..6460af030d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex @@ -11,20 +11,20 @@ Creation | RP.IA = regular_polygon : new (z.I,z.A,6)| \bgroup \catcode`_=12 \small -\captionof{table}{Regular\_polygon attributes.} +\captionof{table}{Regular\_polygon attributes.}\label{regular:att} \begin{tabular}{ll} \toprule -\textbf{Attributes} & \textbf{Application} \\ -\Iattr{square}{center} & |z.I = RP.IA.center| \\ -\Iattr{square}{table} & array containing all vertex affixes \\ -\Iattr{square}{through} & first vertex \\ -\Iattr{square}{circle} & defines the circle with center I passing through A \\ -\Iattr{square}{type} & |RP.IA.type= 'regular\_polygon'| \\ -\Iattr{square}{side} & |s = RP.IA.side| ; s = length of side\\ -\Iattr{square}{exradius}& |S.AB.exradius| ; radius of the circumscribed circle \\ -\Iattr{square}{inradius}& |S.AB.inxradius| ; radius of the inscribed circle \\ -\Iattr{square}{proj} & |RP.IA.proj| ; projection of the center on one side \\ -\Iattr{square}{angle} & |RP.IA.angle| ; angle formed by the center and 2 consecutive vertices \\ +\textbf{Attributes} & \textbf{Application} \\ +\Iattr{regular}{center} & |z.I = RP.IA.center| \\ +\Iattr{regular}{table} & array containing all vertex affixes \\ +\Iattr{regular}{through} & first vertex \\ +\Iattr{regular}{circle} & defines the circle with center I passing through A \\ +\Iattr{regular}{type} & |RP.IA.type= 'regular\_polygon'| \\ +\Iattr{regular}{side} & |s = RP.IA.side| ; s = length of side\\ +\Iattr{regular}{exradius}& |S.AB.exradius| ; radius of the circumscribed circle \\ +\Iattr{regular}{inradius}& |S.AB.inxradius| ; radius of the inscribed circle \\ +\Iattr{regular}{proj} & |RP.IA.proj| ; projection of the center on one side \\ +\Iattr{regular}{angle} & |RP.IA.angle| ; angle formed by the center and 2 consecutive vertices \\ \bottomrule % \end{tabular} \egroup @@ -81,7 +81,7 @@ z.H = RP.five.proj \bgroup \catcode`_=12 \small -\captionof{table}{Circle methods.} +\captionof{table}{Circle methods.}\label{regular:met} \begin{tabular}{ll} \toprule \textbf{Methods} & \textbf{Comments} \\ diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex index 15996c203f..fae6d71b2b 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex @@ -13,7 +13,7 @@ Creation | S.AB = square : new (z.A,z.B,z.C,z.D)| \bgroup \catcode`_=12 \small -\captionof{table}{Square attributes.} +\captionof{table}{Square attributes.}\label{square:att} \begin{tabular}{lll} \toprule \textbf{Attributes} & \textbf{Application} & \\ @@ -98,7 +98,7 @@ z.H = S.new.proj \bgroup \catcode`_=12 \small -\captionof{table}{Square methods.} +\captionof{table}{Square methods.}\label{square:met} \begin{tabular}{lll} \toprule \textbf{Methods} & \textbf{Comments}& \\ diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex index 9c6e822704..a65899c0ef 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex @@ -13,7 +13,7 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \bgroup \catcode`_=12 \small -\captionof{table}{Triangle attributes.} +\captionof{table}{Triangle attributes.}\label{triangle:att} \begin{tabular}{ll} \toprule \textbf{Attributes} & \textbf{Application}\\ @@ -114,7 +114,7 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \catcode`_=12 \small \begin{minipage}{\textwidth} -\captionof{table}{triangle methods.} +\captionof{table}{triangle methods.}\label{triangle:met} \begin{tabular}{ll} \toprule \textbf{Methods} & \textbf{Comments} \\ @@ -154,6 +154,10 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \end{minipage} \egroup +Remark: If you don't need to use the triangle object several times, you can obtain a bisector or a altitude with the next functions + +|bisector (z.A,z.B,z.C)| and |altitude (z.A,z.B,z.C)| See (\ref{misc}) + \clearpage\newpage \bgroup \catcode`_=12 @@ -210,6 +214,7 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point \subsubsection{Euler line} % (fold) \label{ssub:euler_line} +\begin{minipage}{.5\textwidth} \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} z.A = point: new (0 , 0) @@ -229,16 +234,16 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point \tkzDrawCircle[red](N,I) \tkzDrawCircles[teal](O,A) \tkzDrawSegments(A,P B,Q C,R) - \tkzDrawSegments[red](A,I B,J C,K) + \tkzDrawSegments[red](A,I B,J C,K)\include{TKZdoc-elements-classes-triangle.tex} \tkzDrawPolygons(A,B,C) \tkzDrawPoints(A,B,C,N,I,J,K,O,P,Q,R,H,G) \tkzLabelPoints(A,B,C,I,J,K,P,Q,R,H) \tkzLabelPoints[below](N,O,G) \end{tikzpicture} \end{tkzexample} - +\end{minipage} +\begin{minipage}{.5\textwidth} \begin{tkzelements} - scale =1 z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1.5 , 3.5) @@ -250,7 +255,6 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point z.P,z.Q,z.R = get_points (T.ABC: orthic()) z.K,z.I,z.J = get_points (T.ABC: medial ()) \end{tkzelements} - \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -264,54 +268,41 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point \tkzLabelPoints(A,B,C,I,J,K,P,Q,R) \tkzLabelPoints[below](N,O,G,H) \end{tikzpicture} -\hspace*{\fill} +\end{minipage} + %\caption{Euler line} % subsubsection euler_line (end) \subsection{Harmonic division and bisector} % (fold) \label{sub:harmonic_division_and_bisector} -\begin{tkzexample}[small,code only] -\begin{tkzelements} - scale = .75 - z.A = point: new (0 , 0) - z.B = point: new (6 , 0) - z.M = point: new (5 , 4) - T.AMB = triangle : new (z.A,z.M,z.B) - L.AB = T.AMB.ca - L.bis = T.AMB : bisector (1) - z.C = L.bis.pb - L.bisext = T.AMB : bisector_ext (1) - z.D = intersection (L.bisext,L.AB) - L.CD = line: new (z.C,z.D) - z.O = L.CD.mid - L.AM = line: new (z.A,z.M) - L.LL = L.AM : ll_from (z.B) - L.MC = line: new (z.M,z.C) - L.MD = line: new (z.M,z.D) - z.E = intersection (L.LL,L.MC) - z.F = intersection (L.LL,L.MD) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon(A,B,M) - \tkzDrawCircle[purple](O,C) - \tkzDrawSegments[purple](M,E M,D E,F) - \tkzDrawSegments(D,B) - \tkzDrawPoints(A,B,M,C,D,E,F) - \tkzLabelPoints[below right](A,B,C,D,E) - \tkzLabelPoints[above](M,F) - \tkzFillAngles[opacity=.4,cyan!20](A,M,B B,E,M) - \tkzFillAngles[opacity=.4,purple!20](B,M,F M,F,B) - \tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) - \tkzMarkAngles[mark=||](A,M,E E,M,B B,E,M) - \tkzMarkAngles[mark=|](B,M,F M,F,B) - \tkzMarkSegments(B,E B,M B,F) -\end{tikzpicture} -\end{tkzexample} - +\begin{minipage}{.4\textwidth} + \begin{verbatim} + \begin{tkzelements} + scale = .4 + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.M = point: new (5 , 4) + T.AMB = triangle : new (z.A,z.M,z.B) + L.AB = T.AMB.ca + L.bis = T.AMB : bisector (1) + z.C = L.bis.pb + L.bisext = T.AMB : bisector_ext (1) + z.D = intersection (L.bisext,L.AB) + L.CD = line: new (z.C,z.D) + z.O = L.CD.mid + L.AM = line: new (z.A,z.M) + L.LL = L.AM : ll_from (z.B) + L.MC = line: new (z.M,z.C) + L.MD = line: new (z.M,z.D) + z.E = intersection (L.LL,L.MC) + z.F = intersection (L.LL,L.MD) + \end{tkzelements} + \end{verbatim} +\end{minipage} +\begin{minipage}{.6\textwidth} \begin{tkzelements} - scale =.75 + scale =.4 z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.M = point: new (5 , 4) @@ -330,9 +321,7 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point z.E = intersection (L.LL,L.MC) z.F = intersection (L.LL,L.MD) \end{tkzelements} - - -\hspace*{\fill} +\hspace{\fill} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,M) @@ -349,7 +338,28 @@ Through the Lemoine point draw lines parallel to the triangle's sides. The point \tkzMarkAngles[mark=|](B,M,F M,F,B) \tkzMarkSegments(B,E B,M B,F) \end{tikzpicture} -\hspace*{\fill} +\end{minipage} + +\begin{verbatim} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,M) + \tkzDrawCircle[purple](O,C) + \tkzDrawSegments[purple](M,E M,D E,F) + \tkzDrawSegments(D,B) + \tkzDrawPoints(A,B,M,C,D,E,F) + \tkzLabelPoints[below right](A,B,C,D,E) + \tkzLabelPoints[above](M,F) + \tkzFillAngles[opacity=.4,cyan!20](A,M,B B,E,M) + \tkzFillAngles[opacity=.4,purple!20](B,M,F M,F,B) + \tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) + \tkzMarkAngles[mark=||](A,M,E E,M,B B,E,M) + \tkzMarkAngles[mark=|](B,M,F M,F,B) + \tkzMarkSegments(B,E B,M B,F) +\end{tikzpicture} +\end{verbatim} + + % subsection harmonic_division_and_bisector (end) % subsection methods_of_the_class_triangle (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex index e993ce9abe..5e4376b879 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex @@ -49,7 +49,6 @@ Example: The point object is used to vertically determine a new point object l \end{tkzelements} \end{verbatim} - \begin{tkzelements} z.A = point (1,0) z.B = z.A : north (2) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex index baaebd5d71..9e79877299 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex @@ -321,10 +321,8 @@ scale=.75 \tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) \end{tikzpicture} \hspace*{\fill} +% subsection apollonius_and_circle_circumscribed (end) - -%subsection apollonius_and_circle_circumscribed (end) -% \subsection{Apollonius circles in a triangle} % (fold) \label{sub:apollonius_circles} @@ -415,6 +413,26 @@ z.O3 = L.Bpt.mid \tkzDrawLine(O1,O2) \end{tikzpicture} \hspace*{\fill} + +Same result using the function |T.ABC.ab : apollonius (k) | + +\begin{verbatim} + \begin{tkzelements} + scale = .75 + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.C = point: new (4.5 , 1) + T.ABC = triangle : new (z.A,z.B,z.C) + z.O = T.ABC.circumcenter + C.AB = T.ABC.ab : apollonius (length(z.C,z.A)/length(z.C,z.B)) + z.w1,z.t1 = get_points ( C.AB ) + C.AC = T.ABC.ca : apollonius (length(z.B,z.C)/length(z.B,z.A)) + z.w2,z.t2 = get_points ( C.AC ) + C.AC = T.ABC.bc : apollonius (length(z.A,z.B)/length(z.A,z.C)) + z.w3,z.t3 = get_points ( C.AC ) + \end{tkzelements} +\end{verbatim} + % subsection apollonius_circles (end) \subsection{Archimedes} % (fold) @@ -471,8 +489,9 @@ z.O3 = L.Bpt.mid \tkzLabelPoints(A,O_1,O_2,E,F,C,D) \end{tikzpicture} \end{minipage} -%\subsection{Bankoff circle} % (fold) +% subsection archimedes (end) +\subsection{Bankoff circle} % (fold) \label{sub:bankoff_circle} \begin{tkzexample}[small,code only] \begin{tkzelements} @@ -1722,32 +1741,33 @@ z.H = L.XY : projection (z.M) \begin{tkzexample}[latex=0cm,small,code only] \begin{tkzelements} - z.O = point : new (-1,0) - z.Op = point : new (4,-1) - z.B = point : new (0,2) - z.D = point : new (4,0) - C.OB = circle : new (z.O,z.B) - C.OpD = circle : new (z.Op,z.D) - L.EF = C.OB : radical_axis (C.OpD) - z.E,z.F = get_points (L.EF) - z.M = L.EF : point (2) - L.MT,L.MTp = C.OB : tangent_from (z.M) - _,z.T = get_points (L.MT) - _,z.Tp = get_points (L.MTp) - L.MK,L.MKp = C.OpD : tangent_from (z.M) - _,z.K = get_points (L.MK) - _,z.Kp = get_points (L.MKp) +scale = 1.25 +z.O = point : new (-1,0) +z.Op = point : new (4,-1) +z.B = point : new (0,2) +z.D = point : new (4,0) +C.OB = circle : new (z.O,z.B) +C.OpD = circle : new (z.Op,z.D) +L.EF = C.OB : radical_axis (C.OpD) +z.E,z.F = get_points (L.EF) +z.M = L.EF : point (.75) +L.MT,L.MTp = C.OB : tangent_from (z.M) +_,z.T = get_points (L.MT) +_,z.Tp = get_points (L.MTp) +L.MK,L.MKp = C.OpD : tangent_from (z.M) +_,z.K = get_points (L.MK) +_,z.Kp = get_points (L.MKp) \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',D) - \tkzDrawLine[add=1 and 2](E,F) + \tkzDrawLine(E,F) \tkzDrawLine[add=.5 and .5](O,O') - \tkzDrawSegments(M,T M,T' M,K M,K') + \tkzDrawLines[add = 0 and .5](M,T M,T' M,K M,K') \tkzDrawCircle(M,T) \tkzDrawPoints(O,O',T,M,T',K,K') \tkzLabelPoints(O,O',T,T',K,K',M) - \end{tikzpicture} +\end{tikzpicture} \end{tkzexample} \begin{tkzelements} @@ -1760,7 +1780,7 @@ C.OB = circle : new (z.O,z.B) C.OpD = circle : new (z.Op,z.D) L.EF = C.OB : radical_axis (C.OpD) z.E,z.F = get_points (L.EF) -z.M = L.EF : point (2) +z.M = L.EF : point (.75) L.MT,L.MTp = C.OB : tangent_from (z.M) _,z.T = get_points (L.MT) _,z.Tp = get_points (L.MTp) @@ -1768,43 +1788,43 @@ L.MK,L.MKp = C.OpD : tangent_from (z.M) _,z.K = get_points (L.MK) _,z.Kp = get_points (L.MKp) \end{tkzelements} - \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',D) -\tkzDrawLine[add=1 and 2](E,F) +\tkzDrawLine(E,F) \tkzDrawLine[add=.5 and .5](O,O') -\tkzDrawSegments(M,T M,T' M,K M,K') +\tkzDrawLines[add = 0 and .5](M,T M,T' M,K M,K') \tkzDrawCircle(M,T) \tkzDrawPoints(O,O',T,M,T',K,K') \tkzLabelPoints(O,O',T,T',K,K',M) -\end{tikzpicture}\hspace*{\fill} +\end{tikzpicture} +\hspace*{\fill} % subsection radical_axis_v2 (end) \subsection{Radical axis v3} % (fold) \label{sub:radical_axis_v3} \begin{tkzexample}[latex=0cm,small,code only] -\begin{tkzelements} - z.O = point : new (0,0) - z.B = point : new (4,0) - z.Op = point : new (6,0) - C.OB = circle : new (z.O,z.B) - C.OpB = circle : new (z.Op,z.B) - L.EF = C.OB : radical_axis (C.OpB) - z.E,z.F = get_points(L.EF) - z.M = L.EF : point (2) - _,L = C.OB : tangent_from (z.M) - _,z.T = get_points (L) - L,_ = C.OpB : tangent_from (z.M) - _,z.Tp = get_points (L) + \begin{tkzelements} + z.O = point : new (0,0) + z.B = point : new (4,0) + z.Op = point : new (6,0) + C.OB = circle : new (z.O,z.B) + C.OpB = circle : new (z.Op,z.B) + L.EF = C.OB : radical_axis (C.OpB) + z.E,z.F = get_points(L.EF) + z.M = L.EF : point (0.2) + L = C.OB : tangent_from (z.M) + _,z.T = get_points (L) + L = C.OpB : tangent_from (z.M) + _,z.Tp = get_points (L) \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',B) \tkzDrawSegments(M,T M,T') - \tkzDrawLine[add=.5 and 1](E,F) + \tkzDrawSegments(E,F) \tkzDrawLine[add=.5 and .5](O,O') \tkzDrawPoints(O,B,O',E,F,M,T,T') \tkzLabelPoints(O,O',B,E,F,T,T') @@ -1813,27 +1833,25 @@ _,z.Kp = get_points (L.MKp) \end{tkzexample} \begin{tkzelements} -z.O = point : new (0,0) -z.B = point : new (4,0) -z.Op = point : new (6,0) -C.OB = circle : new (z.O,z.B) -C.OpB = circle : new (z.Op,z.B) -L.EF = C.OB : radical_axis (C.OpB) -z.E,z.F = get_points(L.EF) -z.M = L.EF : point (2) -_,L = C.OB : tangent_from (z.M) -_,z.T = get_points (L) -L,_ = C.OpB : tangent_from (z.M) -_,z.Tp = get_points (L) +z.O = point : new (0,0) +z.B = point : new (4,0) +z.Op = point : new (6,0) +C.OB = circle : new (z.O,z.B) +C.OpB = circle : new (z.Op,z.B) +L.EF = C.OB : radical_axis (C.OpB) +z.E,z.F = get_points(L.EF) +z.M = L.EF : point (0.2) +L = C.OB : tangent_from (z.M) +_,z.T = get_points (L) +L = C.OpB : tangent_from (z.M) +_,z.Tp = get_points (L) \end{tkzelements} - - \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',B) \tkzDrawSegments(M,T M,T') -\tkzDrawLine[add=.5 and 1](E,F) +\tkzDrawSegments(E,F) \tkzDrawLine[add=.5 and .5](O,O') \tkzDrawPoints(O,B,O',E,F,M,T,T') \tkzLabelPoints(O,O',B,E,F,T,T') @@ -1853,21 +1871,22 @@ _,z.Tp = get_points (L) C.OpB = circle : new (z.Op,z.B) L.EF = C.OB : radical_axis (C.OpB) z.E,z.F = get_points(L.EF) - z.M = L.EF : point (1.5) - L,_ = C.OB : tangent_from (z.M) + z.H = L.EF.mid + z.M = L.EF : point (.8) + _,L = C.OB : tangent_from (z.M) _,z.T = get_points (L) - L,_ = C.OpB : tangent_from (z.M) + _,L = C.OpB : tangent_from (z.M) _,z.Tp = get_points (L) \end{tkzelements} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',B) \tkzDrawSegments(M,T M,T') - \tkzDrawLine[add=1 and 1](E,F) - \tkzDrawLine[add=.3 and .3](O,O') - \tkzDrawPoints(O,O',B,E,F,T,T',M) - \tkzLabelPoints[below right](O,O',B,E,F,T,T') - \tkzDrawArc(M,T)(B) + \tkzDrawSegments(E,F) + \tkzDrawLine[add=.3 and .3](O,H) + \tkzDrawPoints(O,O',B,E,H,M) + \tkzLabelPoints[below right](O,O',E,F,M,T,T') + \tkzDrawArc(M,B)(T) \end{tikzpicture} \end{tkzexample} @@ -1880,23 +1899,23 @@ _,z.Tp = get_points (L) C.OpB = circle : new (z.Op,z.B) L.EF = C.OB : radical_axis (C.OpB) z.E,z.F = get_points(L.EF) - z.M = L.EF : point (1.5) - L,_ = C.OB : tangent_from (z.M) + z.H = L.EF.mid + z.M = L.EF : point (.8) + _,L = C.OB : tangent_from (z.M) _,z.T = get_points (L) - L,_ = C.OpB : tangent_from (z.M) + _,L = C.OpB : tangent_from (z.M) _,z.Tp = get_points (L) \end{tkzelements} - \hspace*{\fill} \begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(O,B O',B) -\tkzDrawSegments(M,T M,T') -\tkzDrawLine[add=1 and 1](E,F) -\tkzDrawLine[add=.3 and .3](O,O') -\tkzDrawPoints(O,O',B,E,F,T,T',M) -\tkzLabelPoints[below right](O,O',B,E,F,T,T') -\tkzDrawArc(M,T)(B) + \tkzGetNodes + \tkzDrawCircles(O,B O',B) + \tkzDrawSegments(M,T M,T') + \tkzDrawSegments(E,F) + \tkzDrawLine[add=.3 and .3](O,H) + \tkzDrawPoints(O,O',B,E,H,M) + \tkzLabelPoints[below right](O,O',E,F,M,T,T') + \tkzDrawArc(M,B)(T) \end{tikzpicture} \hspace*{\fill} % subsection radical_axis_v4 (end) @@ -1980,7 +1999,7 @@ z.H = L.OOp : projection (z.X) z.I_b,z.Xb = get_points (C.exb) C.exc = T.ABC : ex_circle (2) z.I_c,z.Xc = get_points (C.exc) - C.ortho = radical_circle (C.exa,C.exb,C.exc) + C.ortho = C.exa : radical_circle (C.exb,C.exc) z.w,z.a = get_points (C.ortho) \end{tkzelements} \begin{tikzpicture} @@ -2006,7 +2025,7 @@ z.H = L.OOp : projection (z.X) z.I_b,z.Xb = get_points (C.exb) C.exc = T.ABC : ex_circle (2) z.I_c,z.Xc = get_points (C.exc) - C.ortho = radical_circle (C.exa,C.exb,C.exc) + C.ortho = C.exa : radical_circle (C.exb,C.exc) z.w,z.a = get_points (C.ortho) \end{tkzelements} @@ -2590,7 +2609,7 @@ z.M = L.OOp.mid C.OpD = circle : new (z.Op,z.D) z.E,z.F = get_points (C.OB : radical_axis (C.OpD)) L.EF = line : new (z.E,z.F) - z.M = L.EF : point (2.25) + z.M = L.EF : point (.25) L.T,L.Tp = C.OB : tangent_from (z.M) L.K,L.Kp = C.OpD : tangent_from (z.M) z.T = L.T.pb @@ -2601,7 +2620,7 @@ z.M = L.OOp.mid \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',D) - \tkzDrawLine[add=1 and 2,cyan](E,F) + \tkzDrawLine[cyan](E,F) \tkzDrawLines[add=.5 and .5,orange](O,O' O,T O,T') \tkzDrawSegments[cyan](M,T M,T' M,K M,K') \tkzDrawCircle(M,T) @@ -2620,7 +2639,7 @@ C.OB = circle : new (z.O,z.B) C.OpD = circle : new (z.Op,z.D) z.E,z.F = get_points (C.OB : radical_axis (C.OpD)) L.EF = line : new (z.E,z.F) -z.M = L.EF : point (2.25) +z.M = L.EF : point (.25) L.T,L.Tp = C.OB : tangent_from (z.M) L.K,L.Kp = C.OpD : tangent_from (z.M) z.T = L.T.pb @@ -2633,7 +2652,7 @@ z.Kp = L.Kp.pb \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',D) -\tkzDrawLine[add=1 and 2,cyan](E,F) +\tkzDrawLine[cyan](E,F) \tkzDrawLines[add=.5 and .5,orange](O,O' O,T O,T') \tkzDrawSegments[cyan](M,T M,T' M,K M,K') \tkzDrawCircle(M,T) @@ -2877,9 +2896,9 @@ z.O = L.BA.mid C.C0A = circle : new (z.C_0,z.A) C.C1B = circle : new (z.C_1,z.B) L.EF = C.C0A : radical_axis (C.C1B) - z.M_0 = L.EF : point (2) - z.M_1 = L.EF : point (-1) - z.M_2 = L.EF : point (-2) + z.M_0 = L.EF : point (.4) + z.M_1 = L.EF : point (.1) + z.M_2 = L.EF : point (.6) C.orth0 = C.C0A : orthogonal_from (z.M_0) C.orth1 = C.C0A : orthogonal_from (z.M_1) C.orth2 = C.C0A : orthogonal_from (z.M_2) @@ -2907,9 +2926,9 @@ z.O = L.BA.mid C.C0A = circle : new (z.C_0,z.A) C.C1B = circle : new (z.C_1,z.B) L.EF = C.C0A : radical_axis (C.C1B) - z.M_0 = L.EF : point (2) - z.M_1 = L.EF : point (-1) - z.M_2 = L.EF : point (-2) + z.M_0 = L.EF : point (.4) + z.M_1 = L.EF : point (.1) + z.M_2 = L.EF : point (.6) C.orth0 = C.C0A : orthogonal_from (z.M_0) C.orth1 = C.C0A : orthogonal_from (z.M_1) C.orth2 = C.C0A : orthogonal_from (z.M_2) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex index c8623799ee..935c4fdeea 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex @@ -703,7 +703,8 @@ You obtain a point on the object by entering a real number between 0 and 1. \label{sub:behind_the_objects} Before introducing objects, I only used functions whose parameters were points (comlexes). -For example, |z.m = midpoint_ (z.a,z.b)| defines the midpoint of points $a$ and $b$. Avec les objets, il faut d'abord définir la droite/sgment |L.ab| puis on obtient le milieu avec |z.m = L.ab.mid|. + +For example, |z.m = midpoint_ (z.a,z.b)| defines the midpoint of points $a$ and $b$. With objects, first define the line/sgment |L.ab| and then obtain the middle with |z.m = L.ab.mid|. I've kept the functions (which I'll call "primary") whose only arguments are points. They are distinguished from the others by a terminal underscore. In fact, all (almost) object-related functions depend on a primary function. diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-inversion.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-inversion.tex new file mode 100644 index 0000000000..bb067244d4 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-inversion.tex @@ -0,0 +1,4 @@ +\section{Inversion} % (fold) +\label{sec:inversion} +midcircless +% section inversion (end)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex index c4db9a8816..862be86799 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex @@ -1,6 +1,6 @@ % !TEX TS-program = lualatex % encoding : utf8 -% Documentation of tkz-elements v1.40c +% Documentation of tkz-elements v1.82c % Copyright 2023 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -21,10 +21,10 @@ headings = small ]{tkz-doc} \gdef\tkznameofpack{tkz-elements} -\gdef\tkzversionofpack{1.72c} +\gdef\tkzversionofpack{1.82c} \gdef\tkzdateofpack{\today} \gdef\tkznameofdoc{tkz-elements.pdf} -\gdef\tkzversionofdoc{1.72c} +\gdef\tkzversionofdoc{1.82c} \gdef\tkzdateofdoc{\today} \gdef\tkzauthorofpack{Alain Matthes} \gdef\tkzadressofauthor{} @@ -97,7 +97,7 @@ \usepackage[english]{babel} \usepackage[normalem]{ulem} \usepackage{multirow,multido,booktabs,cellspace} -\usepackage{shortvrb,bookmark,caption,enumitem} +\usepackage{shortvrb,bookmark,enumitem} \usepackage{makeidx} \usepackage[most]{tcolorbox} @@ -145,16 +145,15 @@ sharp corners \newcommand*{\tkzEHand}{\textcolor{red}{\lefthand}} %<---------------------------------------------------------------------------> % settings styles -\tkzSetUpColors[background=white,text=black] -\tkzSetUpCompass[color=orange, line width=.2pt,delta=10] -\tkzSetUpArc[color=gray,line width=.2pt] -\tkzSetUpPoint[size=2,color=teal] -\tkzSetUpLine[line width=.2pt,color=teal] -\tkzSetUpStyle[color=orange,line width=.2pt]{new} -\tikzset{every picture/.style={line width=.2pt}} -\tikzset{label angle style/.append style={color=teal,font=\footnotesize}} -\tikzset{label style/.append style={below,color=teal,font=\scriptsize}} -\tikzset{new/.style={color=orange,line width=.2pt}} + +\tkzSetUpColors[background=white,text=darkgray] +\tkzSetUpPoint[size=2,color=teal,fill=teal!10] +\tkzSetUpLine[ultra thin,color=teal] +\tkzSetUpCompass[color=orange,ultra thin,/tkzcompass/delta=10] +\tikzset{label style/.append style={below right,color=teal,font=\scriptsize}} +\tikzset{new/.style={color=orange,ultra thin}} +\tikzset{step 1/.style={color=cyan,ultra thin}} +\tikzset{step 2/.style={color=purple,ultra thin}} \def\tkzar{\hspace{1em}-->\hspace{1em}} \makeatletter\let\percentchar\@percentchar\makeatother @@ -167,8 +166,11 @@ sharp corners \let\pmpn\pgfmathprintnumber \AtBeginDocument{\MakeShortVerb{\|}} % link to shortvrb + + + \begin{document} -% \LuaCodeDebugOn +\LuaCodeDebugOn \parindent=0pt \tkzTitleFrame{tkz-elements \tkzversionofpack\\Euclidean Geometry} @@ -210,6 +212,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \input{TKZdoc-elements-why.tex} \input{TKZdoc-elements-presentation.tex} \input{TKZdoc-elements-convention.tex} +\input{TKZdoc-elements-organization.tex} \input{TKZdoc-elements-transferts.tex} \input{TKZdoc-elements-classes.tex} \input{TKZdoc-elements-classes-point.tex} @@ -229,4 +232,337 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \clearpage\newpage \small\printindex + +\newpage +\section{Cheat\_sheet} % (fold) +\label{sec:cheat_sheet} + +% section cheat_sheet (end) +|r| denotes a real number, |d| a positive real number, |n|an integer, |an| an angle, |b| a boolean, |s| a character string, |pt| a point, |v| variable, |L| a straight line, |C| a circle, |T| a triangle, |E| an ellipse, |Q| a quadrilateral, |P| a parallelogram, |R| a rectangle, |S| a square, |RP| a regular polygon, |O| an object (pt, L,C,T), . . a list of points or an object, < > optional argument. + +\begin{multicols}{3} + +\fbox{\textbf{Point}}\\ +\textbf{Attributes} table(\ref{point:att}) \\ +|re -> r| \\ +|im -> r| \\ +|type -> s| \\ +|argument -> r| \\ +|modulus -> d| \\ +\textbf{Methods} table(\ref{point:met}) \\ +|+ - * / -> pt| \\ +|.. -> r| \\ +|^ -> r| \\ +|conj -> pt| \\ +|abs -> | \\ +|mod -> | \\ +|norm -> | \\ +|arg -> r| \\ +|get -> r,r| \\ +|sqrt -> pt| \\ +|new -> pt| \\ +|polar -> pt| \\ +|polar_deg -> pt| \\ +|north(d) -> pt| \\ +|south(d) -> pt| \\ +|east(d) -> pt| \\ +|west(d) -> pt| \\ +|normalize(pt) -> pt| \\ +|symmetry (...) -> O| \\ +|rotation (an , ...) -> O| \\ +|homothety (r , ...) -> O| \\ + \\ +\fbox{\textbf{line}} \\ +\textbf{Attributes} table(\ref{line:att}) \\ +|pa,pb -> pt| \\ +|type -> s| \\ +|mid -> pt| \\ +|north_pa -> pt| \\ +|north_pb -> pt| \\ +|south_pa -> pt| \\ +|south_pb -> pt| \\ +|east -> pt| \\ +|west -> pt| \\ +|slope -> r| \\ +|length -> d| \\ +\textbf{Methods} table(\ref{line:met}) \\ +|new (pt,pt) -> d| \\ +|distance (pt) -> d| \\ +|slope () -> r| \\ +|in_out (pt) -> b| \\ +|in_out_segment (pt) -> b| \\ +|barycenter (r,r) -> pt| \\ +|point (t) -> pt| \\ +|midpoint () -> pt| \\ +|harmonic_int (pt) -> pt| \\ +|harmonic_ext (pt) -> pt| \\ +|harmonic_both (d) -> pt| \\ +|gold_ratio() -> pt| \\ +|normalize () -> pt| \\ +|normalize_inv () -> pt| \\ +|_north_pa (d) -> pt| \\ +|_north_pb (d) -> pt| \\ +|_south_pa (d) -> pt| \\ +|_south_pb (d) -> pt| \\ +|_east (d) -> pt| \\ +|_west (d) -> pt| \\ +|translation (...) -> O| \\ +|projection (...) -> O| \\ +|reflection (...) -> O| \\ +|ll_from ( pt ) -> L| \\ +|ortho_from ( pt ) -> L| \\ +|mediator () -> L| \\ +|circle () -> C| \\ +|circle_swap () -> C| \\ +|diameter () -> C| \\ +|apollonius (r) -> C| \\ +|equilateral (<swap>) -> T| \\ +|isosceles (an,<swap>) -> T| \\ +|school () -> T| \\ +|two_angles (an,an) -> T| \\ +|half () -> T| \\ +|sss (r,r,r) -> T| \\ +|sas (r,an) -> T| \\ +|ssa (r,an) -> T| \\ +|gold (<swap>) -> T| \\ +|euclide (<swap>) -> T| \\ +|golden (<swap>) -> T| \\ +|devine () -> T| \\ +|cheops () -> T| \\ +|pythagoras () -> T| \\ +|sublime () -> T| \\ +|egyptian () -> T| \\ +|square (<swap>) -> T| \\ +|report (r,pt) -> T| \\ + \\ +\fbox{\textbf{triangle}} \\ +\textbf{Attributes} table(\ref{triangle:att}) \\ +|pa,pb,pc -> pt| \\ +|circumcenter -> pt| \\ +|centroid -> pt| \\ +|incenter -> pt| \\ +|eulercenter -> pt| \\ +|orthocenter -> pt| \\ +|spiekercenter -> pt| \\ +|type -> s| \\ +|a -> d| \\ +|b -> d| \\ +|c -> d| \\ +|ab -> L| \\ +|bc -> L| \\ +|ca -> L| \\ +|alpha -> r| \\ +|beta -> r| \\ +|gamma -> r| \\ +\textbf{Methods} table(\ref{triangle:met}) \\ +|new (pt,pt,pt) -> pt| \\ +|trilinear (r,r,r) -> pt| \\ +|barycentric (r,r,r) -> pt| \\ +|bevan_point () -> pt| \\ +|mittenpunkt_point () -> pt| \\ +|gergonne_point () -> pt| \\ +|nagel_point () -> pt| \\ +|feuerbach_point () -> pt| \\ +|lemoine_point() -> pt| \\ +|symmedian_point() -> pt| \\ +|spieker_center() -> pt| \\ +|barycenter (r,r,r) -> pt| \\ +|base (u,v) -> pt| \\ +|euler_points () -> pt| \\ +|nine_points () -> pt| \\ +|point (t) -> pt| \\ +|soddy_center () -> pt| \\ +|euler_line () -> L| \\ +|symmedian_line (n) -> L| \\ +|altitude (n) -> L| \\ +|bisector (n) -> L| \\ +|bisector_ext(n) -> L| \\ +|antiparallel(pt,n) -> L| \\ +|euler_circle () -> C| \\ +|circum_circle() -> C| \\ +|in_circle () -> C| \\ +|ex_circle (n) -> C| \\ +|first_lemoine_circle() -> C| \\ +|second_lemoine_circle() -> C| \\ +|spieker_circle() -> C| \\ +|soddy_circle () -> C| \\ +|orthic() -> T| \\ +|medial() -> T| \\ +|incentral() -> T| \\ +|excentral() -> T| \\ +|intouch() -> T| \\ +|contact() -> T| \\ +|extouch() -> T| \\ +|feuerbach() -> T| \\ +|anti () -> T| \\ +|tangential () -> T| \\ +|cevian (pt) -> T| \\ +|symmedian () -> T| \\ +|euler () -> T| \\ +|projection (pt) -> pt,pt,pt| \\ +|parallelogram () -> pt| \\ +|area () -> d| \\ +|barycentric_coordinates(pt)| \\ + |-> r,r,r| \\ +|in_out (pt) -> pt| \\ +|check_equilateral () -> b| \\ +\fbox{\textbf{circle}} \\ +\textbf{Attributes} table(\ref{circle:att}) \\ +|center -> pt| \\ +|through -> pt| \\ +|north -> pt| \\ +|south -> pt| \\ +|east -> pt| \\ +|west -> pt| \\ +|opp -> pt| \\ +|type -> s| \\ +|radius -> d| \\ +|ct -> L| \\ +\textbf{Methods} table(\ref{circle:met}) \\ +|new (pt,pt) -> C| \\ +|radius (pt, r) -> C| \\ +|diameter (pt,pt) -> C| \\ +|in_out (pt) -> b| \\ +|in_out_disk (pt) -> b| \\ +|circles_position (C) -> s| \\ +|power (pt) -> r| \\ +|antipode (pt) -> pt| \\ +|midarc (pt,pt) -> pt| \\ +|point (r) -> pt| \\ +|random_pt (lower, upper) -> pt| \\ +|internal_similitude (C) -> pt| \\ +|external_similitude (C) -> pt| \\ +|radical_center(C,<C>) -> pt| \\ +|tangent_at (pt) -> L| \\ +|radical_axis (C) -> L| \\ +|radical_circle(C,<C>) -> C| \\ +|orthogonal_from (pt) -> C| \\ +|orthogonal_through(pt,pt) -> C| \\ +|midcircle(C) -> C| \\ +|external_tangent(C) -> L,L| \\ +|internal_tangent(C) -> L,L| \\ +|common_tangent(C) -> L,L| \\ +|tangent_from (pt) -> L,L| \\ +|inversion (...) -> O | \\ + \\ +\fbox{\textbf{ellipse}} \\ +\textbf{Attributes} table(\ref{ellipse:met}) \\ +|center -> pt| \\ +|vertex -> pt| \\ +|covertex -> pt| \\ +|Fa -> pt| \\ +|Fb -> pt| \\ +|north -> pt| \\ +|south -> pt| \\ +|east -> pt| \\ +|west -> pt| \\ +|Rx -> d| \\ +|Ry -> d| \\ +|slope -> r| \\ +|type -> s| \\ +\textbf{Methods} table(\ref{ellipse:met}) \\ +|new (pt,pt,pt) -> E| \\ +|foci (pt,pt,pt) -> E| \\ +|radii (pt,r,r,an) -> E| \\ +|in_out (pt) -> b| \\ +|tangent_at (pt) -> L| \\ +|tangent_from (pt) -> L| \\ +|point (r) -> pt| \\ + \\ +\fbox{\textbf{square}} \\ + \textbf{Attributes} table(\ref{square:att}) \\ +|pa,pb,pc,pd -> pt| \\ +|type -> s| \\ +|side -> d| \\ +|center -> pt| \\ +|exradius -> d| \\ +|inradius -> d| \\ +|diagonal -> d| \\ +|proj -> pt| \\ +|ab bc cd da -> L| \\ +|ac bd -> L| \\ + \textbf{Methods} table(\ref{square:met}) \\ +|new (pt,pt,pt,pt) -> S| \\ +|rotation (pt,pt) -> S| \\ +|side (pt,pt,<swap>) -> S| \\ + \\ +\fbox{\textbf{rectangle}} \\ +\textbf{Attributes} table(\ref{rectangle:att}) \\ +|pa,pb,pc,pd -> pt| \\ +|type -> s| \\ +|center -> pt| \\ +|exradius -> d| \\ +|length -> r| \\ +|width -> r| \\ +|diagonal -> d| \\ +|ab bc cd da -> L| \\ +|ac bd -> L| \\ + \textbf{Methods} table(\ref{rectangle:met}) \\ +|new (pt,pt,pt,pt) -> R| \\ +|angle (pt,pt,an) -> R| \\ +|gold (pt,pt,<swap>) -> R| \\ +|diagonal (pt,pt,<swap>) -> R| \\ +|side (pt,pt,r,<swap>) -> R| \\ +|get_lengths () ->r,r| \\ + \\ +\fbox{\textbf{quadrilateral} } \\ + \textbf{Attributes} table(\ref{quadrilateral:att}) \\ +|pa,pb,pc,pd -> pt| \\ +|ab bc cd da -> L | \\ +|ac bd -> L | \\ +|type -> s | \\ +|i -> pt| \\ +|g -> pt| \\ +|a b c d -> r| \\ + \textbf{Methods} table(\ref{quadrilateral:met}) \\ +|new (pt,pt,pt,pt) -> Q| \\ +|iscyclic () -> b| \\ + \\ +\fbox{\textbf{parallelogram}} \\ + \textbf{Attributes} table(\ref{parallelogram:att}) \\ +|pa,pb,pc,pd -> pt| \\ +|ab bc cd da -> L | \\ +|ac bd -> L | \\ +|type -> s | \\ +|center -> pt| \\ + \textbf{Methods} table(\ref{parallelogram:met}) \\ +|new (pt,pt,pt,pt) ->| \\ +|fourth (pt,pt,pt) ->| \\ + \\ +\fbox{\textbf{Regular\_polygon}} \\ + \textbf{Attributes} table(\ref{regular:att}) \\ +|center -> pt| \\ +|through -> pt | \\ +|circle -> C | \\ +|type -> s | \\ +|side -> d| \\ +|exradius -> d| \\ +|inradius -> d| \\ +|proj -> pt| \\ +|nb -> i| \\ +|angle -> an| \\ + \textbf{Methods} table(\ref{regular:met})\\ +|new (pt,pt,n) -> PR| \\ +|incircle () -> C| \\ +|name (s) -> ?| \\ + \\ +\fbox{\textbf{Misc.}} \\ + \textbf{Attributes} table(\ref{misc}) \\ +|tkzphi -> r| \\ +|tkzinvphi -> r | \\ +|tkzsqrtphi -> r | \\ +|length -> d | \\ +|islinear(pt,pt,pt) -> b | \\ +|isortho(pt,pt,pt) -> b | \\ +|\tkzUseLua{v} -> ?| \\ +|value{r} -> r| \\ +|real -> r| \\ +|angle_normalize (an) -> an| \\ +|barycenter (...) -> pt| \\ +|bisector (pt,pt,pt) -> L| \\ +|bisector_ext (pt,pt,pt) -> L| \\ +|altitude (pt,pt,pt) -> L| \\ +|midpoint (pt,pt) -> pt| \\ +|equilateral (pt,pt) -> T| \\ +\end{multicols} \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex new file mode 100644 index 0000000000..f69e0a591d --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex @@ -0,0 +1,100 @@ +\section{Work organization} % (fold) +\label{sec:work_organization} + +Here's a sample organization. + +The line |% !TEX TS-program = lualatex| ensures that you don't forget to compile with Lua\LATEX{}. The "standalone" class is useful, as all you need to do here is create a figure. + +The "mini" option in \pkg{tkz-euclide} allows you to load and use only plot-related macros. + +The package \pkg{ifthen} is useful if you need to use some Boolean. + +The macro \tkzcname{LuaCodeDebugOn} allows you to try and find errors in Lua code. + +It is of course possible to leave the Lua code in the \tkzNameEnv{tkzelements} environment, but externalizing this code has its advantages. + +The first advantage, if you use a good editor, is to have a good presentation of the code. Styles are different between "Lua" and \LATEX{}. This makes the code clearer. This is how I proceeded, then reintegrated the code into the main code. + +Another advantage is that you don't have to comment the code incorrectly. For Lua code, you comment lines with |--| (double minus sign), whereas for \LATEX{}, you comment with |%|. + +Third advantage: the code can be reused. + + + +\begin{verbatim} +% !TEX TS-program = lualatex +% Created by Alain Matthes on 2024-01-09. + +\documentclass[margin = 12pt]{standalone} +\usepackage[mini]{tkz-euclide} +\usepackage{tkz-elements,ifthen} + +\begin{document} +\LuaCodeDebugOn +\begin{tkzelements} + scale = 1.25 + dofile ("sangaku.lua") +\end{tkzelements} + +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(I,F) + \tkzFillPolygon[color = purple](A,C,D)% + \tkzFillPolygon[color = blue!50!black](A,B,C)% + \tkzFillCircle[color = orange](I,F)% +\end{tikzpicture} +\end{document} +\end{verbatim} + +And here is the code for the "Lua" part: the file |ex_sangaku.lua| + +\begin{verbatim} +z.A = point : new ( 0,0 ) +z.B = point : new ( 8,0 ) +L.AB = line : new ( z.A , z.B ) +S = L.AB : square () +_,_,z.C,z.D = get_points (S) +z.F = S.ac : projection (z.B) +L.BF = line : new (z.B,z.F) +T.ABC = triangle : new ( z.A , z.B , z.C ) +L.bi = T.ABC : bisector (2) +z.c = L.bi.pb +L.Cc = line : new (z.C,z.c) +z.I = intersection (L.Cc,L.BF) +\end{verbatim} + +\begin{tkzelements} + scale = 1.25 + dofile ("sangaku.lua") +\end{tkzelements} + +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(I,F) + \tkzFillPolygon[color = purple](A,C,D)% + \tkzFillPolygon[color = blue!50!black](A,B,C)% + \tkzFillCircle[color = orange](I,F)% +\end{tikzpicture} + +\subsection{Scale problem} % (fold) +\label{sub:scale_problem} + +If necessary, it's better to do the scaling in the "Lua" section. The reason is that it will be more accurate. There is, however, a problem to be aware of. I've made it a point of honor to avoid using numerical values in my codes whenever possible. In principle, these values only appear in the definition of fixed points. If the "scale" option is used, scaling is applied when points are created. Let's imagine you want to organize your code as follows: + +|scale = 1.5|\\ +|xB = 8|\\ +|z.B = point : new ( xB,0 )| + +Scaling would then be ineffective, as the numerical values are not modified, only the point coordinates. To take scaling into account, use the function \Igfct{math}{value (v) }. + +|scale = 1.5|\\ +|xB = value (8)|\\ +|z.B = point : new ( xB,0 )| + +\subsection{Code presentation} % (fold) +\label{sub:code_presentation} + +The key point is that, unlike \LATEX{} or \TEX{}, you can insert spaces absolutely anywhere. +% subsection code_presentation (end) +% subsection scale_problem (end) +% section work_organization (end)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-tests.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-tests.tex new file mode 100644 index 0000000000..d43cce663b --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-tests.tex @@ -0,0 +1,4 @@ +\section{tests} % (fold) +\label{sec:tests} + +% section tests (end)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transferts.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transferts.tex index c255a1804d..39d5940e72 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transferts.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transferts.tex @@ -23,49 +23,58 @@ Currently the drawing program is either \TIKZ\ or \pkg{tkz-euclide}. You have th n = string.len(K) if n >1 then _,_,ft, sd = string.find( K , "(.+)(.)" ) - if sd == "p" then K=ft.."'" end + if sd == "p" then K=ft.."'" end + _,_,xft, xsd = string.find( ft , "(.+)(.)" ) + if xsd == "p" then K=xft.."'".."'" end end tex.print("\\coordinate ("..K..") at ("..V.re..","..V.im..") ;\\\\") end} -}\end{verbatim} +} +\end{verbatim} \end{mybox} See the section In-depth Study \ref{sec:in_depth_study} for an explanation of the previous code. -The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and the macro \tkzcname{tkzGetNodes} allows to obtain names of nodes containing \tkzname{prime}. (see the next example) +The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and the macro \tkzcname{tkzGetNodes} allows to obtain names of nodes containing \tkzname{prime} or \tkzname{double prime}. (see the next example) \begin{minipage}{0.5\textwidth} -\begin{tkzexample}[latex=0cm,small,code only] +\begin{verbatim} \begin{tkzelements} scale = 1.2 z.o = point: new (0,0) z.a_1 = point: new (2,1) z.a_2 = point: new (1,2) z.ap = z.a_1 + z.a_2 + z.app = z.a_1 - z.a_2 \end{tkzelements} \begin{tikzpicture} \tkzGetNodes - \tkzDrawSegments(o,a_1 o,a_2 o,a') + \tkzDrawSegments(o,a_1 o,a_2 o,a' o,a'') \tkzDrawSegments[red](a_1,a' a_2,a') - \tkzDrawPoints(a_1,a_2,a',o) - \tkzLabelPoints(o,a_1,a_2,a') + \tkzDrawSegments[blue](a_1,a'' a_2,a'') + \tkzDrawPoints(a_1,a_2,a',o,a'') + \tkzLabelPoints(o,a_1,a_2,a',a'') \end{tikzpicture} -\end{tkzexample}% -\end{minipage}% +\end{verbatim} +\end{minipage} \begin{minipage}{0.5\textwidth} \begin{tkzelements} -scale = 1.2 -z.o = point: new (0,0) -z.a_1 = point: new (2,1) -z.a_2 = point: new (1,2) -z.ap = z.a_1 + z.a_2 + scale = 1.2 + z.o = point: new (0,0) + z.a_1 = point: new (2,1) + z.a_2 = point: new (1,2) + z.ap = z.a_1 + z.a_2 + z.app = z.a_1 - z.a_2 \end{tkzelements} +\hspace{\fill} \begin{tikzpicture} -\tkzGetNodes - \tkzDrawSegments(o,a_1 o,a_2 o,a') - \tkzDrawSegments[red](a_1,a' a_2,a') - \tkzDrawPoints(a_1,a_2,a',o) - \tkzLabelPoints(o,a_1,a_2,a') + \tkzGetNodes + \tkzDrawSegments(o,a_1 o,a_2 o,a' o,a'') + \tkzDrawSegments[red](a_1,a' a_2,a') + \tkzDrawSegments[blue](a_1,a'' a_2,a'') + \tkzDrawPoints(a_1,a_2,a',o,a'') + \tkzLabelPoints(o,a_1,a_2,a',a'') \end{tikzpicture} +\hspace{\fill} \end{minipage}% \newpage diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex index afc64f416d..aa3c23d7d8 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex @@ -69,7 +69,7 @@ The goal is to determine an inner tangent circle to the three exinscribed circle See \href{https://mathworld.wolfram.com/ApolloniusCircle.html}{MathWorld} for more details. -This example was my reference for testing the tkz-euclide package. With my first methods and the tools at my disposition, the results lacked precision. Now, with tkz-elements, I can use tools that are more powerful, more precise and easier to create. +This example was my reference for testing the \pkg{tkz-euclide} package. With my first methods and the tools at my disposition, the results lacked precision. Now, with tkz-elements, I can use tools that are more powerful, more precise and easier to create. The essential principles of figure construction with \tkzname{tkz-euclide} are kept: definitions, calculations, tracings, labels as well as the step-by-step programmation, corresponding to a construction with a ruler and a compass. @@ -136,7 +136,7 @@ Finally, the inversion of the Euler circle with respect to the radical circle is Now that all the points have been defined, it's time to start drawing the paths. To do this, you need to create the nodes. This is the role of the macro \Imacro{tkzGetNodes}. See \ref{ssub:points_transfer} -The following section concerns only drawings, and is handled by tkz-euclide. +The following section concerns only drawings, and is handled by \pkg{tkz-euclide}. \begin{verbatim} \begin{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/gold_preamble.lua b/macros/latex/contrib/tkz/tkz-elements/doc/latex/gold_preamble.lua new file mode 100644 index 0000000000..9067371eb0 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/gold_preamble.lua @@ -0,0 +1,46 @@ +z.A = point: new (0 , 0) +z.B = point: new (10 , 0) +L.AB = line: new ( z.A, z.B) +z.C = L.AB : gold_ratio () +L.AC = line: new ( z.A, z.C) +L.CB = line: new ( z.C, z.B) +z.O_0 = L.AB.mid +z.O_1 = L.AC.mid +z.O_2 = L.CB.mid +C.O0B = circle: new ( z.O_0, z.B) +C.O1C = circle: new ( z.O_1, z.C) +C.O2B = circle: new ( z.O_2, z.B) +z.M_0 = C.O1C : external_similitude (C.O2B) +z.M_1 = C.O0B : internal_similitude (C.O1C) +z.M_2 = C.O0B : internal_similitude (C.O2B) +z.Q = C.O2B.north +z.P = C.O1C.north +z.O = C.O0B.south +z.W = C.O0B.north +L.O1Q = line : new (z.O_1,z.Q) +L.O2P = line : new (z.O_2,z.P) +z.O_4 = intersection (L.O1Q,L.O2P) +L.CO4 = line : new (z.C,z.O_4) +z.D = intersection (L.CO4,C.O0B) +L.CD = line : new (z.C,z.D) +L.PQ = line : new (z.P,z.Q) +L.CQ = line : new (z.C,z.Q) +z.O_5 = intersection (L.CD,L.PQ) +C.QC = circle: new ( z.Q, z.C) +C.PA = circle: new ( z.P, z.A) +z.P_0 = intersection (C.QC,C.O0B) +z.P_1 = intersection (C.QC,C.O1C) +_,z.P_2 = intersection (C.PA,C.O2B) +T.P = triangle: new ( z.P_0, z.P_1, z.P_2) +z.O_3 = T.P.circumcenter +L.AQ = line : new (z.A,z.Q) +L.BP = line : new (z.B,z.P) +z.T = intersection(L.BP,L.AQ) +z.O_6 = L.CD.mid +C.DC = circle : new (z.D,z.C) +z.U,z.V = intersection (C.DC,C.O0B) +L.UV = line : new (z.U,z.V) +z.R,z.S = L.UV : projection (z.O_1,z.O_2) + + + diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/sangaku.lua b/macros/latex/contrib/tkz/tkz-elements/doc/latex/sangaku.lua new file mode 100644 index 0000000000..777528540f --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/sangaku.lua @@ -0,0 +1,14 @@ +xB = value(8) +z.A = point : new ( 0,0 ) +z.B = point : new ( +xB,0 ) +L.AB = line : new ( z.A , z.B ) +S = L.AB : square () +_,_,z.C,z.D = get_points (S) +z.F = S.ac : projection (z.B) +L.BF = line : new (z.B,z.F) +T.ABC = triangle : new ( z.A , z.B , z.C ) +L.bi = T.ABC : bisector (2) +z.c = L.bi.pb +L.Cc = line : new (z.C,z.c) +z.I = intersection (L.Cc,L.BF)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf b/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf Binary files differindex 3dcaf903a2..d5b920c981 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf +++ b/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty b/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty index 903691bcc3..2b388229e4 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty @@ -1,6 +1,6 @@ % encoding : utf8 -% tkz-elements.sty v1.72c -% Copyright 2023 Alain Matthes +% tkz-elements.sty v1.82c +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -11,7 +11,7 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\ProvidesPackage{tkz-elements}[23/12/24 v1.72c Graphic Object Library] +\ProvidesPackage{tkz-elements}[2024/01/16 v1.82c Graphic Object Library] \RequirePackage{luacode} \directlua{require "tkz_elements_main"} @@ -36,7 +36,9 @@ n = string.len(K) if n >1 then _,_,ft, sd = string.find( K , "(.+)(.)" ) - if sd == "p" then K=ft.."'" end + if sd == "p" then K=ft.."'" end + _,_,xft, xsd = string.find( ft , "(.+)(.)" ) + if xsd == "p" then K=xft.."'".."'" end end tex.print("\\coordinate ("..K..") at ("..V.re..","..V.im..") ;\\\\") end} diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua index e81609f6ee..ae257221f4 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua @@ -1,7 +1,7 @@ -- tkz_elements-circles.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -17,9 +17,8 @@ circle = {} function circle: new (c, t) -- c --> center t --> through local type = 'circle' - local ra = line :new (c,t) - local anti = antipode_ (c,t) - local di = line : new (anti, t) + local ct = line :new (c,t) + local opp = antipode_ (c,t) local radius = point.abs ( c - t ) local south = c - point (0,radius) local east = c + point (radius,0) @@ -27,8 +26,8 @@ function circle: new (c, t) -- c --> center t --> through local west = c - point (radius,0) local o = { center = c, through = t, - ra = ra, - di = di, + ct = ct, + opp = opp, radius = radius, south = south, east = east, @@ -75,18 +74,11 @@ function circle: in_out_disk (pt) end end -function circles_position (C1,C2) - local d,max,min - d = point.mod(C1.center-C2.center) - max = C1.radius + C2.radius - min = math.abs ( C1.radius - C2.radius) - if d > max then return "outside" - elseif d == max then return "outside tangent" -- epsilon - elseif d == min then return "inside tangent" -- epsilon - elseif d < min then return "inside" - else return "intersect" - end +-- new version 1.80 added +function circle : circles_position (C) + return circles_position_ (self.center,self.radius,C.center,C.radius) end + ----------------------- -- real -- ----------------------- @@ -122,7 +114,7 @@ function circle: point (t) return rotation_ (self.center,phi,self.through) end -function circle: random_pt(lower, upper) +function circle: random_pt (lower, upper) local t math.randomseed( tonumber(tostring(os.time()):reverse():sub(1,6)) ) phi = lower + math.random() * (upper - lower) @@ -136,6 +128,21 @@ end function circle: external_similitude (C) return external_similitude_ (self.center,self.radius,C.center,C.radius) end + +function circle : common_tangent(C) + local o,s1,s2,t1,t2 + o = external_similitude_ (self.center,self.radius,C.center,C.radius) + + if self.radius < C.radius then + t1,t2 = tangent_from_ (C.center,C.through,o) + s1,s2 = tangent_from_ (self.center,self.through,o) + return s1,t1,t2,s2 + else + s1,s2 = tangent_from_ (C.center,C.through,o) + t1,t2 = tangent_from_ (self.center,self.through,o) + return s1,t1,t2,s2 + end +end ----------------------- -- lines -- ----------------------- @@ -148,12 +155,41 @@ function circle: tangent_from (pt) t1,t2 = tangent_from_ (self.center,self.through,pt) return line :new (pt,t1),line : new (pt,t2) end - + -- version 1.80 function circle: radical_axis (C) local t1,t2 + if self.radius > C.radius then t1,t2 = radical_axis_ (self.center,self.through,C.center,C.through) - return line : new (t1,t2) + else + t1,t2 = radical_axis_ (C.center,C.through,self.center,self.through) end + return line :new (t1,t2) + end + + -- version 1.80 +function circle: radical_center (C1,C2) +if C2 == nil then + if self.radius > C1.radius then + return radical_center_ (self.center,self.through,C1.center,C1.through) + else + return radical_center_ (C1.center,C1.through,self.center,self.through) + end +else + return radical_center3 (self,C1,C2) +end +end + -- version 1.80 +function circle : radical_circle (C1,C2) + local rc + if C2 == nil then + rc = self : radical_center (C1) + return self : orthogonal_from (rc) + else + rc = self : radical_center (C1,C2) + return C1 : orthogonal_from (rc) + end +end + -- version 1.60 new function circle : external_tangent(C) local i,t1,t2,k,T1,T2 @@ -230,7 +266,7 @@ function circle: inversion (...) else t = {} for i=1,tp.n do - table.insert( t , inversion_ (self.center,self.through , tp[i]) ) + table.insert( t , inversion_ (self.center,self.through , tp[i]) ) end return table.unpack ( t ) end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua index 9f8670a1b7..91b12ce31e 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua @@ -1,6 +1,6 @@ -- tkz_elements_class.lua --- date 23/12/24 --- version 1.72c +-- date 2024/01/16 +-- version 1.82c -- from class.lua (Simple Lua Classes from Lua-users wiki) -- Compatible with Lua 5.1 (not 5.0). -- http://lua-users.org/wiki/SimpleLuaClasses DavidManura diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua index bb8495336b..f3fa0d173b 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua @@ -1,7 +1,7 @@ -- tkz_elements-ellipses.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua index cde3c027ac..33477340d3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_circles.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -51,40 +51,55 @@ function inversion_ (c,p,pt) local r = (ry*ry)/d return c+polar_ (r,point.arg(pt-c)) end - + +function circles_position_ (c1,r1,c2,r2) + local d,max,min,epsilon + epsilon = 10^(-12) + d = point.mod(c1-c2) + max = r1+r2 + min = math.abs ( r1 - r2) + if d > max then return "outside" + elseif math.abs(d - max) < epsilon then return "outside tangent" -- epsilon + elseif math.abs(d - min) < epsilon then return "inside tangent" -- epsilon + elseif d < min then return "inside" + else return "intersect" + end +end + function radical_axis_ (c1,p1,c2,p2) - local d,m,m1,m2,epsilon,ci,cj,ck,cm,cn,r1,r2,t + local ci,cj r1 = point.abs(c1-p1) r2 = point.abs(c2-p2) - epsilon = 10^(-12) - d = point.abs (c2 - c1) - m = d - (r1+r2) - m1 = math.abs (d - (r1+r2)) - m2 = math.abs (d - math.abs(r1-(r2))) - if m2 < epsilon then - ci = rotation_ (p1,math.pi/2,c2) - cj = rotation_ (p1,-math.pi/2,c2) - return ci,cj - elseif m1 < epsilon then -- circles tangent - -- z.A = point : new ( x , y ) contact - t,t = intersection_cc_ (c1,p1,c2,p2) - ci = rotation_ (t,math.pi/2,c2) - cj = rotation_ (t,-math.pi/2,c2) - return ci,cj - -- circles disjoints - elseif m > 0 then - ck = rotation_ (c1,math.pi/3,c2) - ci,cj = intersection_cc_ (c1,p1,ck,c1) - cm,cn = intersection_cc_ (c2,p2,ck,c1) - ci = intersection_ll_ (ci,cj,cm,cn) - cj = symmetry_axial_ (c1,c2,ci) -- projection_ (c1,c2,ci) - return ci,cj - else - ci,cj = intersection_cc_ (c1,p1,c2,p2) - return ci,cj - end + d = point.abs(c1-c2) + h = (r1*r1-r2*r2+d*d)/(2*d) + ck = radical_center_ (c1,p1,c2,p2) + cj = rotation_ (ck,-math.pi/2,c1) + ci = symmetry_ (ck,cj) + return cj,ci end +function radical_center_ (c1,p1,c2,p2) + local d,r1,r2,h + r1 = point.abs(c1-p1) + r2 = point.abs(c2-p2) + d = point.abs(c1-c2) + h = (r1*r1-r2*r2+d*d)/(2*d) + return h*(c2-c1)/d+c1 +end + +-- version 1.60 center pour deux cercles ? +function radical_center3 (C1,C2,C3) + local t1,t2,t3,t4 + t1,t2 = radical_axis_ (C1.center,C1.through,C2.center,C2.through) + if C3 == nil then + return intersection_ll_ (t1,t2,C1.center,C2.center) + else + t3,t4 = radical_axis_ (C3.center,C3.through,C2.center,C2.through) +return intersection_ll_ (t1,t2,t3,t4) +end +end + + function south_pole_ (c,p) local r r = point.abs (c-p) @@ -117,7 +132,7 @@ end -- version 1.60 new function midcircle_(C1,C2) local state,r,s,t1,t2,T1,T2,p,a,b,c,d,Cx,Cy,i,j - state = circles_position(C1,C2) + state = circles_position_(C1.center,C1.radius,C2.center,C2.radius) i = barycenter_ ({C2.center,C1.radius},{C1.center,-C2.radius}) j = barycenter_ ({C2.center,C1.radius},{C1.center,C2.radius}) t1,t2 = tangent_from_ (C1.center,C1.through,i) diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua index a3d5bd3a9d..be7eea4461 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua @@ -1,7 +1,7 @@ -- tkz_elements_intersections.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua index 4b27ec821f..642d048809 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_lines.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -50,7 +50,7 @@ function online_ (a,b,t) return (z1+z2)/2 end -- triangle specific -function equilateral_tr (a,b) +function equilateral_tr_ (a,b) return rotation_ (a,math.pi/3,b) end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua index a3c2de28aa..0702b0a568 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_maths.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua index 309b7c762c..dfe86444df 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_points.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua index 423e13a937..4c0db75393 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_regular.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -15,7 +15,7 @@ --------------------------------------------------------------------------- -- --------------------------------------------------------------------------- -function regular_(c,th,s) +function regular_(c,th,s) -- center through side local r,t,dep dep = angle_normalize(point.arg (th-c)) t = {} diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua index 3d92bdb819..c574147912 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_triangles.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua index 1143659bfb..1e45a544db 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua @@ -1,7 +1,7 @@ -- tkz_elements_lines.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -51,6 +51,10 @@ function line: distance (pt) return point.mod(projection(self,pt)-pt) end +function length(a,b) + return point.abs (a-b) +end + function line: slope () return slope_(self.pa,self.pb) end @@ -118,6 +122,36 @@ end function line: normalize_inv () return normalize_ (self.pb,self.pa) end + +function line: _east (d) + local d = d or 1 + return self.pb+ d/self.length * (self.pb-self.pa) +end + +function line: _west (d) + local d = d or 1 + return self.pa+ d/self.length * (self.pa-self.pb) +end + +function line: _north_pa (d) + local d = d or 1 + return d/self.length * ( self.north_pa - self.pa ) + self.pa +end + +function line: _south_pa (d) + local d = d or 1 + return d/self.length *( self.south_pa - self.pa ) + self.pa +end + +function line: _south_pb (d) + local d = d or 1 + return d/self.length *( self.south_pb - self.pb ) + self.pb +end + +function line: _north_pb (d) + local d = d or 1 + return d/self.length *( self.north_pb - self.pb ) + self.pb +end -------------- transformations ------------- function line: translation_pt ( pt ) return translation_ ( self.pb-self.pa,pt ) @@ -262,7 +296,7 @@ function line: ll_from ( pt ) end function line: ortho_from ( pt ) - return line : new (pt,pt+(self.pb-self.pa)*point(0,1)) + return line : new (pt+(self.pb-self.pa)*point(0,-1),pt+(self.pb-self.pa)*point(0,1)) end function line: mediator () @@ -304,12 +338,10 @@ function line: equilateral (swap) if swap then return triangle : new (self.pa,self.pb,rotation_ (self.pa,-math.pi/3,self.pb)) else - return triangle : new (self.pa,self.pb,rotation_ (self.pa,math.pi/3,self.pb)) - + return triangle : new (self.pa,self.pb,rotation_ (self.pa,math.pi/3,self.pb)) end end - function line: isosceles (phi,swap) local pta,ptb if swap == nil then @@ -324,9 +356,55 @@ function line: isosceles (phi,swap) ptb = rotation_ (self.pb,-phi,self.pa) return triangle : new (self.pa,self.pb, intersection_ll_ (self.pa,pta,self.pb,ptb )) end - end +function line: two_angles (alpha,beta) + local pta,ptb,pt + pta = rotation_ (self.pa,alpha,self.pb) + ptb = rotation_ (self.pb,-beta,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end + +function line: school () + local pta,ptb,pt + pta = rotation_ (self.pa,math.pi/6,self.pb) + ptb = rotation_ (self.pb,-math.pi/3,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end + +function line: half () + local x,pt + x = midpoint_(self.pa,self.pb) + pt = rotation_ (self.pb,-math.pi/2,x) + return triangle : new (self.pa,self.pb,pt) +end + +function line: sss (a,b) + local pta,ptb,i,j + pta = self.pa + point ( a, 0 ) + ptb = self.pb + point ( -b , 0) + i,j = intersection_cc_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,i),triangle : new (self.pa,self.pb,j) +end + +function line: ssa (a,phi) + local x,y,pt + x = rotation_ (self.pb,-phi,self.pa) + y = self.pa + polar_ ( a , self.slope) + i,j = intersection_lc_ (self.pb,x,self.pa,y) + return triangle : new (self.pa,self.pb,i),triangle : new (self.pa,self.pb,j) +end + +function line: sas (a,phi) + local x,pt + x = self.pa + polar_ ( a , self.slope) + pt = rotation_ (self.pa,phi,x) + return triangle : new (self.pa,self.pb,pt) +end +---- sacred triangles ---- + function line: gold (swap) local pt if swap == nil then @@ -341,6 +419,16 @@ else end end +function line: sublime () + local pta,ptb,pt + pta = rotation_ (self.pa,2*math.pi/5,self.pb) + ptb = rotation_ (self.pb,-2*math.pi/5,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end + +line.euclid = line.sublime + function line: euclide (swap) if swap == nil then swap = false @@ -352,20 +440,39 @@ else end end -function line: golden (swap) - local pt - local pta,ptb - if swap == nil then - swap = false - end -if swap then - pt = rotation_ (self.pa,-2*math.pi/5,self.pb) - return triangle : new (self.pa,self.pb, self.pa + (pt-self.pa) * tkzphi) -else - pt = rotation_ (self.pa,2*math.pi/5,self.pb) - return triangle : new (self.pa,self.pb, self.pa + (pt-self.pa) * tkzphi) - end +function line: divine () + local pta,ptb,pt,h + pta = rotation_ (self.pa,math.pi/5,self.pb) + ptb = rotation_ (self.pb,-math.pi/5,self.pa) + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) + return triangle : new (self.pa,self.pb,pt) +end + +function line: cheops () + local m,n,pt + m = midpoint_ (self.pa,self.pb) + n = rotation_ (m,- math.pi/2,self.pa) + pt = m + (n-m)* tkzsqrtphi + return triangle : new (self.pa,self.pb,pt) end + +function line: egyptian () + local n,pt + n = rotation_ (self.pb,- math.pi/2,self.pa) + pt = self.pb + (n-self.pb)/point.mod(n-self.pb)*self.length* 0.75 + return triangle : new (self.pa,self.pb,pt) +end +line.pythagoras = line.egyptian +line.isis = line.egyptian + +function line: golden () + local n,pt + n = rotation_ (self.pb,- math.pi/2,self.pa) + pt = self.pb + (n-self.pb)/tkzphi + return triangle : new (self.pa,self.pb,pt) +end + + ------------------------------ -- Result -> couple of points ------------------------------ diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua index 44842d2d9c..132f193667 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua @@ -1,7 +1,7 @@ -- tkz_elements-main.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua index ed4dd949a1..23f088983f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua @@ -1,7 +1,7 @@ -- tkz_elements_functions_maths.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -33,26 +33,31 @@ function set_lua_to_tex (t) token.set_macro(v,_ENV[v],'global') end end --- version 1.60 center pour deux cercles ? -function radical_center (C1,C2,C3) - local t1,t2,t3,t4 - t1,t2 = radical_axis_ (C1.center,C1.through,C2.center,C2.through) - if C3 == nil then - return intersection_ll_ (t1,t2,C1.center,C2.center) - else - t3,t4 = radical_axis_ (C3.center,C3.through,C2.center,C2.through) -return intersection_ll_ (t1,t2,t3,t4) + +function bisector (a,b,c) + local i + i = in_center_ (a,b,c) + return line : new (a,intersection_ll_ (a,i,b,c)) end + +function altitude (a,b,c) + local o,p + o = ortho_center_ (a,b,c) + p = projection_ (b,c,a) + return line : new (a,p) end --- version 1.60 modif case 2 circles -function radical_circle (C1,C2,C3) - local rc - if C3 == nil then - rc = radical_center (C1,C2) - return C1 : orthogonal_from (rc) - else - rc = radical_center (C1,C2,C3) - return C1 : orthogonal_from (rc) + +function bisector_ext(a,b,c) -- n =1 swap n=2 2 swap + local i,p + i = in_center_ (a,b,c) + p = rotation_ (a,math.pi/2,i) + return line : new (a,p) end + +function equilateral (a,b) + return equilateral_tr_ (a,b) end +function midpoint (a,b) + return (a+b)/2 +end
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua index 6ed56cc828..386eb023e0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua @@ -1,7 +1,7 @@ -- tkz_elements_parallelogram.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -16,7 +16,7 @@ --------------------------------------------------------------------------- parallelogram = {} -function parallelogram: new (za, zb, zc,zd) +function parallelogram: new (za, zb, zc, zd) local d,epsilon epsilon = 10^(-8) local zi = midpoint_ (za,zc) diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua index 4997b857d8..7530dfc96a 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua @@ -1,7 +1,7 @@ -- tkz_elements_point.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -187,7 +187,7 @@ function point: new ( a,b ) end function point: polar ( radius, phi ) - return scale * polar_ ( radius, phi ) + return point: new (radius * math.cos(phi), radius * math.sin(phi)) end function point: polar_deg ( radius, phi ) @@ -196,22 +196,22 @@ end function point: north(d) local d = d or 1 - return self+ polar_ ( d * scale, math.pi/2 ) + return self+ polar_ ( d , math.pi/2 ) end function point: south(d) local d = d or 1 - return self + polar_ ( d * scale, 3 * math.pi/2 ) + return self + polar_ ( d , 3 * math.pi/2 ) end function point: east(d) local d = d or 1 - return self+ polar_( d * scale, 0 ) + return self+ polar_( d , 0 ) end function point: west(d) local d = d or 1 - return self + polar_ ( d * scale, math.pi ) + return self + polar_ ( d , math.pi ) end -- ---------------------------------------------------------------- -- transformations diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua index 57d8af3aae..e80065540b 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua @@ -1,7 +1,7 @@ -- tkz_elements_quadrilateral.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua index 600d31665b..abb9c2f8e9 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua @@ -1,7 +1,7 @@ -- tkz_elements-rectangle.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -36,7 +36,7 @@ function rectangle: new (za, zb,zc,zd) local bd = line : new (zb,zd) local length = point.mod (zb-za) local width = point.mod (zd-za) - local diagonal = point.abs (zc-za) + local diagonal = point.abs (zc-za) local o = { pa = za, pb = zb, pc = zc, @@ -47,7 +47,7 @@ function rectangle: new (za, zb,zc,zd) da = da, cd = cd, bd = bd, - diagonal = diagonal, + diagonal = diagonal, exradius = exradius, center = center, length = length, diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua index c0749917f5..dbd6273205 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua @@ -1,7 +1,7 @@ -- tkz_elements_regular.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua index 4c3ce73800..e9854efbe3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua @@ -1,7 +1,7 @@ -- tkz_elements-square.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua index 4a0c892f60..d68084d5f8 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua @@ -1,7 +1,7 @@ -- tkz_elements_triangles.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. @@ -56,6 +56,15 @@ end ----------------------- -- points -- ----------------------- +-- version 1.80 +function triangle: trilinear (a,b,c) + return barycenter_ ( {self.pa,a*self.a },{self.pb,b*self.b},{self.pc,c*self.c} ) +end + +function triangle: barycentric (a,b,c) + return barycenter_ ( {self.pa,a },{self.pb,b},{self.pc,c} ) +end + function triangle: bevan_point () return circum_center_ ( self : excentral_tr()) end @@ -128,6 +137,11 @@ function triangle : point (t) return self.ca : point ((t*p-self.c-self.b)/self.a) end end + +function triangle : soddy_center () + local s,i,j,k + return soddy_center_ (self.pa,self.pb,self.pc) +end ------------------- -- Result -> line ------------------- @@ -152,17 +166,20 @@ function triangle: symmedian_line (n) end function triangle: altitude (n) - local a,b,c,o + local a,b,c,o,p a = self.pa b = self.pb c = self.pc o = ortho_center_ (a,b,c) if n==1 then - return line : new (b,intersection_ll_ (b,o,a,c)) + p = projection_ (a,c,b) + return line : new (b,p) elseif n==2 then - return line : new (c,intersection_ll_ (c,o,a,b)) + p = projection_ (a,b,c) + return line : new (c,p) else - return line : new (a,intersection_ll_ (a,o,b,c)) + p = projection_ (b,c,a) + return line : new (a,p) end end @@ -223,7 +240,7 @@ local a,b,c,i,u,v,w end end ----------------------- --- circles -- +--- Result -> circles -- ----------------------- function triangle: euler_circle () return circle : new (euler_center_ ( self.pa , self.pb , self.pc),midpoint_( self.pb , self.pc)) @@ -281,6 +298,12 @@ local ma,mb,mc,sp return circle : new (sp,projection_ (ma,mb,sp)) end + +function triangle : soddy_circle () + local s,i + s,i = soddy_center_ (self.pa,self.pb,self.pc) + return circle : new ( s , i ) +end ------------------- -- Result -> triangle ------------------- @@ -367,19 +390,6 @@ function triangle: parallelogram () local x = self.pc + self.pa - self.pb return x end - -function triangle: check_equilateral () - local A,B,C,epsilon - epsilon = 10 ^(-8) - A = self.pb - self.pc - B = self.pa - self.pc - C = self.pa - self.pb - if (point.abs(A)-point.abs(B) < epsilon) and (point.abs(B)-point.abs(C) < epsilon) - then - tex.print("equilateral !!") - error("something went wrong!") - end -end function triangle: area () return area_(self.pa,self.pb,self.pc) @@ -396,15 +406,7 @@ end function triangle: check_equilateral () return check_equilateral_ (self.pa,self.pb,self.pc) end -function triangle : soddy_center () - local s,i,j,k - return soddy_center_ (self.pa,self.pb,self.pc) -end -function triangle : soddy_circle () - local s,i - s,i = soddy_center_ (self.pa,self.pb,self.pc) - return circle : new ( s , i ) -end + return triangle
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua index 17d5684304..c2802cd41f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua @@ -1,7 +1,7 @@ -- tkz_elements_vectors.lua --- date 23/12/24 --- version 1.72c --- Copyright 2023 Alain Matthes +-- date 2024/01/16 +-- version 1.82c +-- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 -- of this license or (at your option) any later version. diff --git a/macros/latex/contrib/tkz/tkz-euclide/README.md b/macros/latex/contrib/tkz/tkz-euclide/README.md index c50db0cb55..bb5e16af3a 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/README.md +++ b/macros/latex/contrib/tkz/tkz-euclide/README.md @@ -1,6 +1,5 @@ # tkz-euclide — for euclidean geometry - -Release 5.04c 2023/10/26 +Release 5.05c 2024/01/16 ## Description @@ -64,6 +63,7 @@ Other examples, in French, are on my site. ## History +- 5.05c Correction of the documentation. - 5.04c Some files have been renamed. @@ -107,8 +107,7 @@ Complement in the documentation for the macro `\tkzDefCircle[R](....)`. You can Thus `\tkzDrawSquare(A,B)` becomes `\tkzDefSquare(A,B)` `\tkzGetPoints{C}{D}` then `\tkzDrawPolygon(A,B,C,D)` ; - - + If you want to draw a circle, you can't do so \tkzDrawCircle[R](A,1) . First you have to define the point through which the circle passes, so you have to do `\tkzDefCircle[R](A,1)` `\tkzGetPoint{a}` and finally `\tkzDrawCircle(A,a)` . Another possibilty is to define a point on the circle `\tkzDefShiftPoint[A](1,O){a}` ; @@ -150,32 +149,24 @@ Complement in the documentation for the macro `\tkzDefCircle[R](....)`. You can Correct allocation for gold sublime and euclide triangles; - I added the option " next to" for the intersections LC and CC; - Correction option isoceles right; - `\tkzDefMidArc(O,A,B)` gives the middle of the arc center $O$ from $A$ to $B$; Good news : Some useful tools have been added. They are present on an experimental basis and will undoubtedly need to be improved; - The options "orthogonal from and through" depend now of `tkzDefCircleBy` - `\tkzDotProduct(A,B,C)` computes the scalar product in an orthogonal reference system of the vectors $\overrightarrow{A,B}$ and $\overrightarrow{A,C}$. `\tkzDotProduct(A,B,C)=aa'+bb' if vec{AB} =(a,b) and vec{AC} =(a',b')` - `\tkzPowerCircle(A)(B,C)` power of point $A$ with respect to the circle of center $B$ passing through $C$; - `\tkzDefRadicalAxis(A,B)(C,D)` Radical axis of two circles of center $A$ and $C$; - Some tests : `\tkzIsOrtho(A,B,C)` and `\tkzIsLinear(A,B,C)` The first indicates whether the lines AB and AC are orthogonal. The second indicates whether the points $A$, $B$ and $C$ are aligned; `\tkzIsLinear(A,B,C)` if A, B, C are aligned then \tkzLineartrue diff --git a/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-main.tex b/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-main.tex index 6e98386a2d..7bdf444be9 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-main.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-main.tex @@ -21,10 +21,10 @@ headings = small ]{tkz-doc} \gdef\tkznameofpack{tkz-euclide} -\gdef\tkzversionofpack{5.04c} +\gdef\tkzversionofpack{5.05c} \gdef\tkzdateofpack{\today} \gdef\tkznameofdoc{doc-tkz-euclide} -\gdef\tkzversionofdoc{5.04c} +\gdef\tkzversionofdoc{5.05c} \gdef\tkzdateofdoc{\today} \gdef\tkzauthorofpack{Alain Matthes} \gdef\tkzadressofauthor{} diff --git a/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-news.tex b/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-news.tex index eac5c1a797..0d6149ff96 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-news.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-news.tex @@ -1,5 +1,9 @@ \section*{News and compatibility} +\subsection{With 5.05 version} % (fold) + + Correction of the documentation in Complete but minimal example. + \subsection{With 5.03 version} % (fold) \begin{itemize} diff --git a/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-presentation.tex b/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-presentation.tex index 6228a9b8a8..bb70c73788 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-presentation.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-presentation.tex @@ -532,8 +532,8 @@ $IB=a$, $AI=1$ \tkzDrawSegment[style=orange](I,C) \tkzDrawArc(M,B)(A) \tkzDrawSegment[dim={$1$,-16pt,}](A,I) - \tkzDrawSegment[dim={$a/2$,-10pt,}](I,M) - \tkzDrawSegment[dim={$a/2$,-16pt,}](M,B) + \tkzDrawSegment[dim={$(a-1)/2$,-10pt,}](I,M) + \tkzDrawSegment[dim={$(a+1)/2$,-16pt,}](M,B) \tkzMarkRightAngle[ra](A,I,C) \tkzDrawPoints(I,A,B,C,M) \tkzLabelPoint[left](A){$A(0,0)$} diff --git a/macros/latex/contrib/tkz/tkz-euclide/doc/tkz-euclide.pdf b/macros/latex/contrib/tkz/tkz-euclide/doc/tkz-euclide.pdf Binary files differindex 76a0b3c7f5..1e7e46b430 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/doc/tkz-euclide.pdf +++ b/macros/latex/contrib/tkz/tkz-euclide/doc/tkz-euclide.pdf diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-angles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-angles.tex index 001c8f3226..4a83e27f02 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-angles.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-angles.tex @@ -1,5 +1,5 @@ % tkz-tool-eu-angles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tool-eu-angles.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tool-eu-angles.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzSetUpArc diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-circles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-circles.tex index aef5271531..30c1d594f1 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-circles.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-circles.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-draw-circles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-draw-circles.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-draw-circles.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzSetUpCircle diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-compass.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-compass.tex index 046bd4b9bd..fc1f5d524a 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-compass.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-compass.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-compass.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-compass.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-compass.tex} \makeatletter %<--------------------------------------------------------------------------–> % Author Alain Matthes diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-ellipses.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-ellipses.tex index cbacfdd3d4..a7b15ffcc1 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-ellipses.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-ellipses.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-draw-ellipses.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-draw-ellipses.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-draw-ellipses.tex} \makeatletter diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-lines.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-lines.tex index 0a5c9c1be8..7ee9e0cf0d 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-lines.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-lines.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-draw-lines.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-draw-lines.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-draw-lines.tex} \makeatletter %<--------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-points.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-points.tex index 520e3159e8..ac5eee4a3d 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-points.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-points.tex @@ -1,5 +1,5 @@ % tkz-draw-points.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-draw-eu-points.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-draw-eu-points.tex} \makeatletter %<---------------------------------------------------------------------------> % tkzSetUpPoint définit la forme d'un point @@ -24,7 +24,7 @@ shape/.store in = \tkz@pt@shape, size = \tkz@euc@pointsize, color = \tkz@euc@pointcolor, - fill = \tkz@euc@pointcolor, + fill = \tkz@euc@pointfillcolor, shape = \tkz@euc@pointshape, /tkzsetuppt/.search also = {/tikz}, } diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-polygons.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-polygons.tex index df42073c07..b2a94785f5 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-polygons.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-polygons.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-polygons.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-polygons.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-polygons.tex} \makeatletter %<--------------------------------------------------------------------------–> % Polygon diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-protractor.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-protractor.tex index 1400924439..4b8beae952 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-protractor.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-protractor.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-protractor.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-protractor.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-protractor.tex} \makeatletter %<--------------------------------------------------------------------------–> % !!! idea from Y. Combe !!! diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-sectors.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-sectors.tex index 31684e81fe..83d9c371c1 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-sectors.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-sectors.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-sectors.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-sectors.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-sectors.tex} \makeatletter %<----------------------- Sectors ------------------------------–> \gdef\tkz@nums{0} diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-show.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-show.tex index 7dd82c3f3b..fd829793ba 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-show.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/drawings/tkz-draw-eu-show.tex @@ -1,5 +1,5 @@ %tkz-obj-eu-show.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-show.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-show.tex} \makeatletter %<--------------------------------------------------------------------------–> % finding specific points in a triangle diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/libs/tkz-lib-eu-marks.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/libs/tkz-lib-eu-marks.tex index 5c25cf710e..acab14a9e9 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/libs/tkz-lib-eu-marks.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/libs/tkz-lib-eu-marks.tex @@ -1,5 +1,5 @@ % tkz-eu-lib-marks.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-lib-eu-marks.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-lib-eu-marks.tex} \makeatletter %<--------------------------------------------------------------------------–> % Création des symboles diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/libs/tkz-lib-eu-shape.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/libs/tkz-lib-eu-shape.tex index f21fa29fd9..a353cb2169 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/libs/tkz-lib-eu-shape.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/libs/tkz-lib-eu-shape.tex @@ -1,5 +1,5 @@ % tkz-lib-eu-shape.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-lib-eu-shape.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-lib-eu-shape.tex} %<--------------------------------------------------------------------------–> % Création des symboles %<--------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-circles-by.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-circles-by.tex index 3dc06c7e29..ebfcfd365f 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-circles-by.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-circles-by.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-circles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -11,8 +11,8 @@ % The Current Maintainer of this work is Alain Matthes. \def\fileversion{6.00} -\def\filedate{2023/10/26} -\typeout{2023/10/26 6.00 tkz-obj-eu-circles.tex} +\def\filedate{2024/01/16} +\typeout{2024/01/16 6.00 tkz-obj-eu-circles.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzCircle center and one point diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-circles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-circles.tex index b6d733b242..2fd7b062a7 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-circles.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-circles.tex @@ -1,5 +1,5 @@ % tkz-obj-lua-circles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-lua-circles.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-lua-circles.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzCircle center and one point diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-by.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-by.tex index 3333524d78..ff47818ce5 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-by.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-by.tex @@ -1,5 +1,5 @@ % tkz-tools-lua-points-by.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-lua-points-by.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-lua-points-by.tex} \makeatletter %<--------------------------------------------------------------------------–> % Transformations Géométriques diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-spc.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-spc.tex index 6003bb8efe..e37d8d41c1 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-spc.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-spc.tex @@ -1,5 +1,5 @@ % tkz-obj-lua-points.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/01/23} -\typeout{2023/01/23 5.04c tkz-obj-lua-points-spc.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/23} +\typeout{2024/01/23 5.05c tkz-obj-lua-points-spc.tex} \makeatletter %add ExCenter %<--------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-with.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-with.tex index fe5ba902c0..b781bac070 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-with.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points-with.tex @@ -1,5 +1,5 @@ % tkz-obj-lua-points-with.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-lua-points-with.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-lua-points-with.tex} \makeatletter %<--------------------------------------------------------------------------–> % Vectors diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points.tex index 744639a8a3..ce88d4ef0c 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj-lua/tkz-obj-eu-lua-points.tex @@ -1,5 +1,5 @@ % tkz-obj-lua-points.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-lua-points.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-lua-points.tex} \makeatletter %<---------------------------------------------------------------------------> % init def point diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-axesmin.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-axesmin.tex index 1684d3b5cd..db87376b84 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-axesmin.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-axesmin.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-axesmin.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-axesmin} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-axesmin} \makeatletter \def\removedot#1.{#1} diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles-by.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles-by.tex index 05b66f6f10..66454d0663 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles-by.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles-by.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-circles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-circles.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-circles.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzCircle center and one point diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles.tex index 2f57f39d16..832ecef382 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-circles.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-circles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-circles.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-circles.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzCircle center and one point diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-grids.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-grids.tex index e09d0b5b53..5f86300aae 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-grids.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-grids.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-grids.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-grids.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-grids.tex} \makeatletter %<--------------------------------------------------------------------------–> % Setup Grid diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-lines.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-lines.tex index 31bcc0d577..c51814eef6 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-lines.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-lines.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-lines.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-lines.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-lines.tex} \makeatletter %<--------------------------------------------------------------------------–> % les lignes diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-by.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-by.tex index b23f431925..684abf37aa 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-by.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-by.tex @@ -1,5 +1,5 @@ % tkz-tools-eu-points-by.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-points-by.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-points-by.tex} \makeatletter %<--------------------------------------------------------------------------–> % Transformations Géométriques diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-rnd.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-rnd.tex index 838d573ff2..258fd309d1 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-rnd.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-rnd.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-points-rnd.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-points-rnd.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-points-rnd.tex} %<--------------------------------------------------------------------------–> \makeatletter %<-------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-spc.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-spc.tex index ac65123719..52a0cfb613 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-spc.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-spc.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-points.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-el-points.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-el-points.tex} \makeatletter %add ExCenter %<--------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-with.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-with.tex index 9d73a8316f..7bb3ed0611 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-with.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points-with.tex @@ -1,5 +1,5 @@ % tkz-obj-el-points-with.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-points-with.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-points-with.tex} \makeatletter %<--------------------------------------------------------------------------–> % Vectors diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points.tex index 70e6c0702a..974c593bb4 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-points.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-points.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-points.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-points.tex} \makeatletter %<---------------------------------------------------------------------------> % init def point diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-polygons.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-polygons.tex index 6bdf499aa6..e73638800d 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-polygons.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-polygons.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-polygons.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-polygons.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-polygons.tex} % bug in regular polygon side 2020/03/09 \makeatletter %<--------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-triangles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-triangles.tex index 0312eaca5d..eebaf5b511 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-triangles.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/obj/tkz-obj-eu-triangles.tex @@ -1,5 +1,5 @@ % tkz-obj-eu-triangles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-triangles.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-triangles.tex} \makeatletter %<--------------------------------------------------------------------------–> % Triangle Equilateral diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-euclide.cfg b/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-euclide.cfg index b62312367e..5647683bbe 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-euclide.cfg +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-euclide.cfg @@ -1,5 +1,5 @@ % tkz-euclide.cfg -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -16,9 +16,9 @@ % and save the file in a directory part of your TEXINPUTS environment % variable. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-euclide.cfg} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-euclide.cfg} %<------ colors ---------------------------------------–> \def\tkz@backgroundcolor{white} \def\tkz@textcolor{black} @@ -29,6 +29,7 @@ %<-------------------------- points -----------------------------------–> \def\tkz@euc@pointshape{circle} \def\tkz@euc@pointcolor{\tkz@mainlinecolor} +\def\tkz@euc@pointfillcolor{\tkz@euc@pointcolor!10} \def\tkz@euc@labelcolor{\tkz@mainlinecolor} \def\tkz@euc@pointsize{2} \def\tkz@euc@pointpos{below right} @@ -38,7 +39,7 @@ inner sep = 0pt, shape = \tkz@euc@pointshape, minimum size = \tkz@euc@pointsize, - fill = \tkz@euc@pointcolor + fill = \tkz@euc@pointfillcolor } } % label for the point @@ -134,7 +135,7 @@ arc style/.style={% \def\tkz@mk@fill{\tkz@otherlinecolor} %<--------------------------------------------------------------------------–> %<------------------------------ styles ---------------------------------–> -\def\tkzSetUpStyle[#1]#2{\tikzset{#2/.style={#1}}}% add 2023 +\def\tkzSetUpStyle[#1]#2{\tikzset{#2/.style={#1}}}% add 2024 \tikzset{xlabel style/.style = {below = 3 pt, inner sep = 1pt, diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-euclide.sty b/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-euclide.sty index 8c8208f98a..988d84de40 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-euclide.sty +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tkz-euclide.sty @@ -1,5 +1,5 @@ % tkz-euclide.sty -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,11 +10,11 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. %------------------------------------------------------------------------------- -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-euclide.sty} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-euclide.sty} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tkz-euclide}[ 2023/10/26 5.04c for pure Euclidean Geometry ] +\ProvidesPackage{tkz-euclide}[ 2024/01/16 5.05c for pure Euclidean Geometry ] \newif\if@tkzlua \@tkzluafalse \DeclareOption{lua}{\@tkzluatrue} @@ -70,11 +70,11 @@ {\pgfmath@y\dimexpr\pgfmath@y/10000\relax} {}{\PatchFailed} -%------------------------------------------------------------------------------- +%------------------------------- \newdimen\tkzRadius \newdimen\tkzLength \newdimen\tkz@radi -%------------------------------------------------------------------------------- +%------------------------------- % tkz registres \newdimen\tkz@ax \newdimen\tkz@ay @@ -121,9 +121,9 @@ \newif\iftkz@swap \newif\iftkz@init@NO \newif\iftkz@integer -\newif\iftkz@Rep@orig%--------------------- Rep +\newif\iftkz@Rep@orig%---------------------- Rep \newif\iftkzLengthIncm%--------------------- Math -\newif\iftkz@sop@show%--------------------- marks +\newif\iftkz@sop@show%---------------------- marks \newif\iftkz@equi@show \newif\iftkz@gd@sub% sub grid ?%--------------------- about grid \newif\iftkz@node\tkz@nodefalse @@ -158,11 +158,11 @@ %<----------------------------------------------------------> % Initialisation %<----------------------------------------------------------> + \if@tkzlua \RequirePackage{luacode} \fi - \@ifpackageloaded{tkz-base}{}{% % from base \input{tkz-tools-eu-base.tex} @@ -177,7 +177,7 @@ \input{tkz-obj-eu-points.tex} \input{tkz-draw-eu-points.tex} } -% % next from euclide +% next from euclide \makeatletter \if@tkzlua \input{tkz-tools-eu-lua-base.tex} @@ -206,7 +206,6 @@ \input{tkz-obj-eu-lines.tex} \input{tkz-obj-eu-polygons.tex} \input{tkz-obj-eu-triangles} - % drawings \input{tkz-draw-eu-lines.tex} \input{tkz-draw-eu-circles.tex} @@ -217,5 +216,4 @@ \input{tkz-draw-eu-compass.tex} \input{tkz-draw-eu-show.tex} \input{tkz-draw-eu-protractor.tex} - \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-angles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-angles.tex index e5c9d373c6..38c516af97 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-angles.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-angles.tex @@ -1,5 +1,5 @@ % tkz-tools-lua-angles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-lua-angles.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-lua-angles.tex} \makeatletter \def\tkzmathrotatepointaround#1#2#3{% \pgf@process{% diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-base.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-base.tex index 45068a64e3..7466e412ca 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-base.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-base.tex @@ -1,5 +1,5 @@ % tkz-tools-lua-base.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-lua-base.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-lua-base.tex} \makeatletter %<--------------------------------------------------------------------------–> \global\let\tkz@tmp@xa\tkz@init@xmin% modif 2016 diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-intersections.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-intersections.tex index 127db80eba..8e675e781b 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-intersections.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-intersections.tex @@ -1,5 +1,5 @@ % tkz-tools-lua-intersections.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -13,9 +13,9 @@ % The Current Maintainer of this work is Alain Matthes. % utf8 encoding -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-lua-intersections.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-lua-intersections.tex} \makeatletter %<--------------------------------------------------------------------------–> % intersection de deux lignes diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-math.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-math.tex index dc92fb70ca..3945213364 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-math.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools-lua/tkz-tools-eu-lua-math.tex @@ -1,5 +1,5 @@ % tkz-tools-lua-math.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-lua-math.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-lua-math.tex} \makeatletter %<--------------------------------------------------------------------------> %<--------------------------------------------------------------------------> diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-BB.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-BB.tex index 3212c55e44..82b8a602e2 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-BB.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-BB.tex @@ -1,5 +1,5 @@ % tkz-tools-eu-BB.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-obj-eu-BB.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-obj-eu-BB.tex} \makeatletter %<--------------------------------------------------------------------------–> \def\tkzShowBB{\pgfutil@ifnextchar[{\tkz@ShowBB}{\tkz@ShowBB[]}} diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-angles.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-angles.tex index f32c105855..abbadef102 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-angles.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-angles.tex @@ -1,5 +1,5 @@ % tkz-tools-angles.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-angles.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-angles.tex} \makeatletter %<--------------------------------------------------------------------------–> %<--------------------------------------------------------------------------–> diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-base.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-base.tex index 22a7787ae6..f034d12e9c 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-base.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-base.tex @@ -1,5 +1,5 @@ % tkz-tools-eu-base.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-base.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-base.tex} \makeatletter %<--------------------------------------------------------------------------–> \global\let\tkz@tmp@xa\tkz@init@xmin% modif 2016 diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-colors.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-colors.tex index b991a2fd22..074b294bdb 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-colors.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-colors.tex @@ -1,5 +1,5 @@ % tkz-tools-eu-colors -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-colors} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-colors} \makeatletter %<------ Initialisation of the colors with tkzSetUpColors -----------------> @@ -42,14 +42,14 @@ \def\tkzSetUpAllColors{\pgfutil@ifnextchar[{\tkz@SetUpAllColors}{% \tkz@SetUpAllColors[]}} \def\tkz@SetUpAllColors[#1]{% - \pgfqkeys{/tkzsupallcol}{#1} % now we redine the based colors + \pgfqkeys{/tkzsupallcol}{#1} % now we redefines the based colors \def\tkz@fillcolor{\tkz@suac@bkc} \def\tkz@mainlinecolor{\tkz@suac@txt} \def\tkz@textcolor{\tkz@suac@txt} \def\tkz@otherlinecolor{\tkz@suac@txt!50} \def\tkz@sua@color{\tkz@suac@txt} \tkzSetUpAxis[color=\tkz@suac@txt] - \tkzSetUpGrid[color=\tkz@suac@txt] + \tkzSetUpGrid[color=\tkz@suac@txt] \pagecolor{\tkz@suac@bkc} \color{\tkz@suac@txt} } diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-intersections.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-intersections.tex index fdab77f658..a380d31ea5 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-intersections.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-intersections.tex @@ -1,5 +1,5 @@ % tkz-tools-intersections.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -13,9 +13,9 @@ % The Current Maintainer of this work is Alain Matthes. % utf8 encoding -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-intersections.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-intersections.tex} \makeatletter %<--------------------------------------------------------------------------–> % intersection de deux lignes @@ -462,7 +462,7 @@ \edef\tkz@xx{\fpeval{\tkz@ax+\tkz@aa/\tkz@dd*(\tkz@bx - \tkz@ax)}} \edef\tkz@yy{\fpeval{\tkz@ay+\tkz@aa/\tkz@dd*(\tkz@by - \tkz@ay)}} \path[coordinate](\tkz@xx pt,\tkz@yy pt) coordinate (tkzRadialCenter); -\edef\tkz@hh{\fpeval{sqrt(abs((\tkz@cx+\tkz@aa)*(\tkz@cx-\tkz@aa)))}}% abs !2023 +\edef\tkz@hh{\fpeval{sqrt(abs((\tkz@cx+\tkz@aa)*(\tkz@cx-\tkz@aa)))}}% abs !2024 \edef\tkz@rx{\fpeval{\tkz@hh / \tkz@dd * (\tkz@ay - \tkz@by)}} \edef\tkz@ry{\fpeval{\tkz@hh / \tkz@dd * (\tkz@bx - \tkz@ax)}} \edef\tkz@xs{\fpeval{\tkz@xx + \tkz@rx}} diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-math.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-math.tex index 9e39d90217..b9bef42168 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-math.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-math.tex @@ -1,5 +1,5 @@ % tkz-tools-eu-math.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-math.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-math.tex} \makeatletter %<--------------------------------------------------------------------------> % \tkzpointnormalised# diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-modules.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-modules.tex index 916b166af9..19b9b54a36 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-modules.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-modules.tex @@ -1,5 +1,5 @@ % tkz-tools-modules -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-utilities.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-utilities.tex} \makeatletter %<------------- % chargement des modules ----------------------------------> \def\tkz@obj@all{angles,arcs,compass,defcircles,deflines,defpoints,defpointsby,defpointsrnd,defpointswith,polygons,protractor,sectors,show,triangles}% diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-text.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-text.tex index 66dbf64bd7..a40f61c655 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-text.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-text.tex @@ -1,5 +1,5 @@ % tkz-tools-eu-text.tex -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-text.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-text.tex} \makeatletter %<--------------------------------------------------------------------------–> % tkzText diff --git a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-utilities.tex b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-utilities.tex index 0bf0b046a9..b5d1b43331 100644 --- a/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-utilities.tex +++ b/macros/latex/contrib/tkz/tkz-euclide/latex/tools/tkz-tools-eu-utilities.tex @@ -1,5 +1,5 @@ % tkz-tools-eu-utilities -% Copyright 2023 Alain Matthes +% Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -10,9 +10,9 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\def\fileversion{5.04c} -\def\filedate{2023/10/26} -\typeout{2023/10/26 5.04c tkz-tools-eu-utilities.tex} +\def\fileversion{5.05c} +\def\filedate{2024/01/16} +\typeout{2024/01/16 5.05c tkz-tools-eu-utilities.tex} \makeatletter \pgfkeys{/tkzClip/.cd, space/.store in = {\tkz@CLI@space}, |