diff options
Diffstat (limited to 'macros/latex')
101 files changed, 5381 insertions, 1263 deletions
diff --git a/macros/latex/contrib/circledtext/README.md b/macros/latex/contrib/circledtext/README.md new file mode 100644 index 0000000000..6c49b9f7cd --- /dev/null +++ b/macros/latex/contrib/circledtext/README.md @@ -0,0 +1,60 @@ +Create circled text based on l3draw +======= + +`circledtext` is a LaTeX3 package developed based on l3draw, which provides macros `\circledtext`. + +You can read the manual (in Chinese/English) for more details and examples. + +Contributing +------------ + +1. github repository: + 1. repository: [circledtext](https://github.com/registor/circledtext) + 2. Issues and pull requests are welcome. [issue](https://github.com/registor/circledtext/issues) or [pull request](https://github.com/registor/circledtext/pulls). + +2. gitee repository: + 1. repository: [circledtext](https://gitee.com/nwafu_nan/circledtext) + 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/circledtext/issues) or [pull request](https://gitee.com/nwafu_nan/circledtext/pulls). + +基于l3draw的带圈字符(串)生成宏包 +======= + +`circledtext`是一个基于l3draw用LaTeX3开发的带圈字符(串)生成宏包,它提供了用于排版带圈字符(串)的命令`\circledtext`用于实现带圈字符(串)排版。 + +可以通过阅读宏包手册(中文/英文)以了解该宏包更多的使用细节和使用样例。 + +### 参与贡献 +--------------------- + +1. github仓库: + (1). 仓库地址: [circledtext](https://github.com/registor/circledtext) + (2). Issues和PR: [issue](https://github.com/registor/circledtext/issues) or [pull request](https://github.com/registor/circledtext/pulls). + +2. gitee仓库: + (1). 仓库地址: [circledtext](https://gitee.com/nwafu_nan/circledtext) + (2). Issues and PR: [issue](https://gitee.com/nwafu_nan/circledtext/issues) or [pull request](https://gitee.com/nwafu_nan/circledtext/pulls). + +Copyright and Licence +--------------------- + + Copyright (C) 2020-2022 by Nan Geng <nangeng@nwafu.edu.cn> + ---------------------------------------------------------------------- + + 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. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and the latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 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 Nan Geng. + + This package consists of circledtext.sty, circledtext.tex and README.md(this file), + and the derived files circledtext.pdf. + + diff --git a/macros/latex/contrib/circledtext/build.sh b/macros/latex/contrib/circledtext/build.sh new file mode 100755 index 0000000000..7da6da74cf --- /dev/null +++ b/macros/latex/contrib/circledtext/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +xelatex circledtext.tex &&\ +makeindex -s gind.ist -o circledtext.ind circledtext.idx &&\ +makeindex -s gglo.ist -o circledtext.gls circledtext.glo &&\ +xelatex circledtext.tex &&\ +xelatex circledtext.tex &&\ +xelatex circledtext.tex diff --git a/macros/latex/contrib/circledtext/circledtext.pdf b/macros/latex/contrib/circledtext/circledtext.pdf Binary files differnew file mode 100644 index 0000000000..aa7369ad60 --- /dev/null +++ b/macros/latex/contrib/circledtext/circledtext.pdf diff --git a/macros/latex/contrib/circledtext/circledtext.sty b/macros/latex/contrib/circledtext/circledtext.sty new file mode 100644 index 0000000000..d8f125043f --- /dev/null +++ b/macros/latex/contrib/circledtext/circledtext.sty @@ -0,0 +1,952 @@ +%% Copyright (C) 2020-2022 by Nan Geng <nangeng@nwafu.edu.cn> +%% -------------------------------------------------------------------------- +%% +%% 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. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 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 Nan Geng. +%% +%% -------------------------------------------------------------------------- +%% +\NeedsTeXFormat{LaTeX2e}[2020/10/01] +\RequirePackage{expl3} +\ProvidesExplPackage{circledtext}{2022-04-24}{v1.0.0} + {Typeset circled text with l3draw} + +\RequirePackage { xtemplate, l3keys2e, l3draw, xparse } + +% 保证TeXLive的向下兼容 +\cs_if_free:NT \box_ht_plus_dp:N + { + \cs_new_protected:Npn \box_ht_plus_dp:N #1 + { \tex_dimexpr:D \box_ht:N #1 + \box_dp:N #1 \scan_stop: } + } + +% 带圈文字用户接口 +% #1 *号命令,实现阴文 +% #2 格式选项 +% #3 文字 +\NewDocumentCommand{\circledtext}{ s O{} m } + { + \group_begin: + \IfBooleanTF{ #1 } + { + \bool_set_true:N \l__circledtext_negative_bool + }{ + \bool_set_false:N \l__circledtext_negative_bool + } + \__circledtext_handle:nn { #2 } { #3 } + \group_end: + } + +% 是否反白标志 +\bool_new:N \l__circledtext_negative_bool + +% 基字符盒子 +\box_new:N \l__circledtext_basebox_box + +% 字符盒子类型 +\tl_new:N \l__circledtext_char_box_type_tl +% 字符盒子类型列表 +\clist_new:N \g__circledtext_char_box_list_clist + +% 缩放方式 +\tl_new:N \l__circledtext_resize_method_tl +% 缩放方式列表 +\clist_new:N \g__circledtext_resize_method_clist + +% 基字符盒子正方形连长 +\dim_new:N \l__circledtext_char_box_size_dim +% 基字符盒子正方形外接圆半径 +\dim_new:N \l__circledtext_char_box_radius_dim +% 基字符宽度 +\dim_new:N \l__circledtext_char_width_dim +% 基字符高度 +\dim_new:N \l__circledtext_char_height_dim +% 字符(串)盒子宽度 +\dim_new:N \l__circledtext_box_width_dim +% 字符(串)盒子高度 +\dim_new:N \l__circledtext_box_height_dim +% 字符(串)外框线宽 +\dim_new:N \l__circledtext_box_linewidth_dim +% 字符(串)内部十字、米字装饰线线宽 +\dim_new:N \l__circledtext_cross_linewidth_dim +% 字符(串)深度(带格式) +\dim_new:N \l__circledtext_char_dp_dim + +% 字符(串)盒子容器 +\coffin_new:N \l__circledtext_str_box_coffin +% 字符框盒子容器 +\coffin_new:N \l__circledtext_box_coffin +% 字符盒子容器 +\coffin_new:N \l__circledtext_char_coffin +% 临时盒子容器 +\coffin_new:N \l__circledtext_tmpa_coffin +% 临时盒子容器 +\coffin_new:N \l__circledtext_tmpb_coffin + +% 基字符宽度 +\dim_new:N \charboxwd +% 基字符高度 +\dim_new:N \charboxht + +% 待处理字符(串) +\tl_new:N \l__circledtext_chars_tl +% 字符(串)排版格式 +\tl_new:N \l__circledtext_character_format_tl +% 内部十字、米字装饰线颜色点边框颜色比例 +\int_new:N \l__circledtext_cross_color_ratio_int +\int_set:Nn \l__circledtext_cross_color_ratio_int { 30 } +% 字符(串)的字形类型(实线、虚线等) +\int_new:N \l__circledtext_charstroke_type_int + +% 填充色辅助函数 +\cs_new_nopar:Nn \__circledtext_aux_color_boxfill: + { } + +% 颜色命名函数 +% #1 颜色名称 +% #2 颜色表达式 +\cs_set_nopar:Npn \__circledtext_color_select:nn #1#2 + { + \color_set:nn {#1} {#2} + } +\cs_generate_variant:Nn \__circledtext_color_select:nn {nx} + +% 颜色命名函数 +% #1 颜色名称 +% #2 颜色空间 +% #3 颜色分量值 +\cs_set_nopar:Npn \__circledtext_color_select:nnn #1#2#3 + { + \color_set:nnn {#1} {#2} {#3} + } +\cs_generate_variant:Nn \__circledtext_color_select:nnn {nnx} + +% 计算基字符的宽和高 +\cs_new:Npn \__circledtext_calc_basechar_w_h: + { + \dim_set:Nn \l__circledtext_char_width_dim + { + \box_wd:N \l__circledtext_basebox_box + } + \dim_set:Nn \l__circledtext_char_height_dim + { + \box_ht_plus_dp:N \l__circledtext_basebox_box + } + } + +% 盒子容器总高度计算函数 +\cs_new_nopar:Npn \__circledtext_coffin_ht_plus_dp:N #1 + { + \coffin_ht:N #1 + \coffin_dp:N #1 + } + +% 计算基字符外框大小(外接正方形边长和外接圆半径) +\cs_new:Npn \__circledtext_calc_char_box_size: + { + % 设置基字符格式的基字符盒子 + \hbox_set:Nn \l_tmpa_box + { + \tl_use:N \l__circledtext_character_format_tl + \tl_use:N \c__circledtext_basechar_tl + } + + % 盒子宽度 + \dim_set:Nn \l_tmpa_dim + { + \box_wd:N \l_tmpa_box + } + % 盒子高度 + \dim_set:Nn \l_tmpb_dim + { + \box_ht_plus_dp:N \l_tmpa_box + } + + % 盒子深度 + \dim_set:Nn \l__circledtext_char_dp_dim + { + \box_dp:N \l_tmpa_box + } + + % 正方形边长 + \dim_compare:nNnTF \l_tmpa_dim > \l_tmpb_dim + { + \dim_gset_eq:NN \l__circledtext_char_box_size_dim \l_tmpa_dim + } + { + \dim_gset_eq:NN \l__circledtext_char_box_size_dim \l_tmpb_dim + } + + % 设置基字符盒子正方形宽和高(相等) + \dim_gset_eq:NN \charboxwd \l__circledtext_char_box_size_dim + \dim_gset_eq:NN \charboxht \l__circledtext_char_box_size_dim + + % 外接圆半径 + \dim_gset:Nn \l__circledtext_char_box_radius_dim + { + \fp_to_dim:n + { + \fp_eval:n { \l__circledtext_char_box_size_dim * sqrt(2)/ 2 } + } + } + } + +% 字符盒子构造类型函数名称生成函数 +% 名称中6个参数分别表示: +% #1 左下角x坐标 +% #2 左下角y坐标 +% #3 右上角x坐标 +% #4 右上角y坐标 +% #5 x方向缩放比例(扩展保留参数) +% #6 y方向缩放比例(扩展保留参数) +\cs_new_nopar:Npn \__circledtext_char_box_type:n #1 + { + __circledtext_char_box_construct_type_ #1 :nnnnnn + } +% 字符盒子构造类型函数名称命令生成函数 +% 名称命令中6个参数分别表示: +% #1 左下角x坐标 +% #2 左下角y坐标 +% #3 右上角x坐标 +% #4 右上角y坐标 +% #5 x方向缩放比例(扩展保留参数) +% #6 y方向缩放比例(扩展保留参数) +\cs_new_nopar:Npn \__circledtext_char_box_type_c:n #1 + { + \use:c + { + __circledtext_char_box_construct_type_ #1 :nnnnnn + } + } + +% 字符盒子构造类型函数生成器函数 +% #1 类型名称 +\cs_new:Npn \__circledtext_new_char_box_construct:nn #1 + { + % 将类型名称记入clist + \clist_put_right:Nn \g__circledtext_char_box_list_clist {#1} + % 类似\cs_new:cn __circledtext_char_box_construct_type_none:nnnnnn + \cs_new:cn { \__circledtext_char_box_type:n {#1} } + } + +% 定义字符边框盒子类型 + +% 无边框 +\__circledtext_new_char_box_construct:nn { none } { } + +% 实心正方形 +\__circledtext_new_char_box_construct:nn { filledsquare } + { + \cs_if_eq:NNF \__circledtext_aux_color_boxfill: \c_empty_tl + { + \__circledtext_aux_color_boxfill: + \draw_scope_begin: + \bool_if:NTF \l__circledtext_negative_bool + { + \color_fill:n { circledtextcharcolor } + }{ + \color_fill:n { circledtextboxfill } + } + % \color_fill:n { circledtextboxfill } + \draw_path_rectangle:nn { #1, #2 } { #3, #4 } + \draw_path_use_clear:n { fill } + \draw_scope_end: + } + } + +% 外框正方形 +\__circledtext_new_char_box_construct:nn { boxsquare } + { + \draw_scope_begin: + \color_stroke:n { circledtextcharboxcolor } + \draw_path_rectangle:nn { #1, #2 } { #3, #4 } + \draw_path_use_clear:n { stroke } + \draw_scope_end: + } + +% 正方形对角十字线 +\__circledtext_new_char_box_construct:nn { dcrosssquare } + { + \draw_scope_begin: + \tl_if_empty:NF \l__circledtext_dash_pattern_tl + { + \exp_args:No \draw_dash_pattern:nn { \l__circledtext_dash_pattern_tl } { 0pt } + } + \draw_linewidth:n{ \l__circledtext_cross_linewidth_dim } + \color_stroke:n { circledtextcrosscolor } + \draw_path_moveto:n { #1, #2 } + \draw_path_lineto:n { #3, #4 } + \draw_path_moveto:n { #1, #4 } + \draw_path_lineto:n { #3, #2 } + \draw_path_use_clear:n { stroke } + \draw_scope_end: + } + +% 对角十字线 +\__circledtext_new_char_box_construct:nn { crosssquare } + { + \draw_scope_begin: + \tl_if_empty:NF \l__circledtext_dash_pattern_tl + { + \exp_args:No \draw_dash_pattern:nn { \l__circledtext_dash_pattern_tl } { 0pt } + } + \draw_linewidth:n{ \l__circledtext_cross_linewidth_dim } + \color_stroke:n { circledtextcrosscolor } + \draw_path_moveto:n { #3/2, #2 } + \draw_path_lineto:n { #3/2, #4 } + \draw_path_moveto:n { #1, #4/2 } + \draw_path_lineto:n { #3, #4/2 } + \draw_path_use_clear:n { stroke } + \draw_scope_end: + } + +% 实心圆 +\__circledtext_new_char_box_construct:nn { filledcircle } + { + \cs_if_eq:NNF \__circledtext_aux_color_boxfill: \c_empty_tl + { + \__circledtext_aux_color_boxfill: + \draw_scope_begin: + \bool_if:NTF \l__circledtext_negative_bool + { + \color_fill:n { circledtextcharcolor } + }{ + \color_fill:n { circledtextboxfill } + } + % \color_fill:n { circledtextboxfill } + \draw_path_circle:nn + { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} } + { \l__circledtext_char_box_radius_dim } + \draw_path_use_clear:n { fill } + \draw_scope_end: + } + } + +% 外框圆 +\__circledtext_new_char_box_construct:nn { boxcircle } + { + \draw_scope_begin: + \color_stroke:n { circledtextcharboxcolor } + \draw_path_circle:nn + { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} } + { \l__circledtext_char_box_radius_dim } + \draw_path_use_clear:n { stroke } + \draw_scope_end: + } + +% 十字线 +\__circledtext_new_char_box_construct:nn { cross } + { + \draw_scope_begin: + \tl_if_empty:NF \l__circledtext_dash_pattern_tl + { + \exp_args:No \draw_dash_pattern:nn { \l__circledtext_dash_pattern_tl } { 0pt } + } + \draw_linewidth:n{ \l__circledtext_cross_linewidth_dim } + \color_stroke:n { circledtextcrosscolor } + \draw_path_moveto:n + { + \draw_point_intersect_line_circle:nnnnn + { #3/2, #2 } % line's first point + { #3/2, #4 } % line's second point + { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} } + { \l__circledtext_char_box_radius_dim } + {1} % index of intersect + } + \draw_path_lineto:n + { + \draw_point_intersect_line_circle:nnnnn + { #3/2, #2 } % line's first point + { #3/2, #4 } % line's second point + { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} } + { \l__circledtext_char_box_radius_dim } + {2} % index of intersect + } + \draw_path_moveto:n + { + \draw_point_intersect_line_circle:nnnnn + { #1, #4/2 } % line's first point + { #3, #4/2 } % line's second point + { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} } + { \l__circledtext_char_box_radius_dim } + {1} % index of intersect + } + \draw_path_lineto:n + { + \draw_point_intersect_line_circle:nnnnn + { #1, #4/2 } % line's first point + { #3, #4/2 } % line's second point + { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} } + { \l__circledtext_char_box_radius_dim } + {2} % index of intersect + } + \draw_path_use_clear:n { stroke } + \draw_scope_end: + } + +% 对角十字线 +\__circledtext_new_char_box_construct:nn { dcross } + { + \draw_scope_begin: + \tl_if_empty:NF \l__circledtext_dash_pattern_tl + { + \exp_args:No \draw_dash_pattern:nn { \l__circledtext_dash_pattern_tl } { 0pt } + } + \draw_linewidth:n{ \l__circledtext_cross_linewidth_dim } + \color_stroke:n { circledtextcrosscolor } + \draw_path_moveto:n { #1, #2 } + \draw_path_lineto:n { #3, #4 } + \draw_path_moveto:n { #1, #4 } + \draw_path_lineto:n { #3, #2 } + \draw_path_use_clear:n { stroke } + \draw_scope_end: + } + +% 米字线 +\__circledtext_new_char_box_construct:nn { x+ } + { + \__circledtext_char_box_type_c:n { dcross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { cross } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 带边框实心圆 +\__circledtext_new_char_box_construct:nn { o } + { + \__circledtext_char_box_type_c:n { filledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { boxcircle } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 带边框和内十字线实心圆 +\__circledtext_new_char_box_construct:nn { o+ } + { + \__circledtext_char_box_type_c:n { filledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { cross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { boxcircle } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 带边框和内对角十字线实心圆 +\__circledtext_new_char_box_construct:nn { ox } + { + \__circledtext_char_box_type_c:n { filledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { dcross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { boxcircle } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 带边框和内米字线实心圆 +\__circledtext_new_char_box_construct:nn { ox+ } + { + \__circledtext_char_box_type_c:n { filledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { dcross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { cross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { boxcircle } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 带边框实心正方形 +\__circledtext_new_char_box_construct:nn { O } + { + \__circledtext_char_box_type_c:n { filledsquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { boxsquare } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 正方形米字线 +\__circledtext_new_char_box_construct:nn { X+ } + { + \__circledtext_char_box_type_c:n { dcrosssquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { crosssquare } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 带边框和内十字线实心正方形 +\__circledtext_new_char_box_construct:nn { O+ } + { + \__circledtext_char_box_type_c:n { filledsquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { crosssquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { boxsquare } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 带边框和内对角十字线实心正方形 +\__circledtext_new_char_box_construct:nn { OX } + { + \__circledtext_char_box_type_c:n { filledsquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { dcrosssquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { boxsquare } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 带边框和内米字线实心正方形 +\__circledtext_new_char_box_construct:nn { OX+ } + { + \__circledtext_char_box_type_c:n { filledsquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { dcrosssquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { crosssquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { boxsquare } {#1} {#2} {#3} {#4} {#5} {#6} + } + +\msg_new:nnn { circledtext } { box-exists } { The~ box~ type~ `#1~ not~ exists. } + +% 缩放类型名称生成函数 +\cs_new_nopar:Npn \__circledtext_resize:n #1 + { + __circledtext_processor_resize_ #1 :w + } + +% 缩放类型函数名称命令生成函数 +\cs_new_nopar:Npn \__circledtext_resize_c:n #1 + { + \use:c + { + __circledtext_processor_resize_ #1 :w + } + } + +% 缩放代码生成函数 +% #1 dim长度变量1 +% #2 dim长度变量2 +% #3 缩放代码1 +% #4 缩放代码2 +% #5 缩放代码3 +% 如果 #1 > 0 ,取#3代码 +% 如果 #1 <= 0 且#2 > 0 ,取#4代码 +% 如果 #1 <= 0 且#2 <= 0,取#5代码 +\cs_new:Npn \__circledtext_dim_gezero_dispatch:NNnnn #1#2 #3#4#5 + { + \dim_compare:nNnTF #1 > \c_zero_dim + { #3 } + { + \dim_compare:nNnTF #2 > \c_zero_dim + { #4 } { #5 } + } + } + +% 缩放代码生成函数 +% #1 dim长度变量1 +% #2 dim长度变量2 +% #3 缩放代码1 +% #4 缩放代码2 +% #5 缩放代码3 +% #6 缩放代码4 +% 如果 #1 > 0 且 #2 > 0 ,取#3代码 +% 如果 #1 > 0 且 #2 <= 0,取#4代码 +% 如果 #1 <= 0 且 #2 > 0 ,取#5代码 +% 如果 #1 <= 0 且 #2 <= 0,取#6代码 +\cs_new:Npn \__circledtext_dim_gezero_dispatch:NNnnnn #1#2 #3#4#5#6 + { + \dim_compare:nNnTF #1 > \c_zero_dim + { + \dim_compare:nNnTF #2 > \c_zero_dim + { #3 } { #4 } + } + { + \dim_compare:nNnTF #2 > \c_zero_dim + { #5 } { #6 } + } + } + +% 缩放代码生成函数(分别按高度、宽度或实际尺寸缩放) +\cs_new:Npn \__circledtext_force_size_dispatch:nnn % height, width, none + { + \__circledtext_dim_gezero_dispatch:NNnnn \l__circledtext_height_dim + \l__circledtext_width_dim + } + +% 缩放代码生成函数(分别按高宽、高度、宽度或实际尺寸缩放) +\cs_new:Npn \__circledtext_force_size_dispatch:nnnn % both, height, width, none + { + \__circledtext_dim_gezero_dispatch:NNnnnn \l__circledtext_box_height_dim + \l__circledtext_box_width_dim + } + +% 构造缩放类型 +\cs_new:Npn \__circledtext_new_resize_method:nn #1 + { + \clist_put_right:Nn \g__circledtext_resize_method_clist {#1} + \cs_new:cpn { \__circledtext_resize:n {#1} } + } + +% 无缩放 +\__circledtext_new_resize_method:nn { none } { } + +% 按实际参数缩放 +\__circledtext_new_resize_method:nn { real } + { + \__circledtext_force_size_dispatch:nnnn + {% 盒子宽高缩放 + \coffin_resize:Nnn \l__circledtext_box_coffin + \l__circledtext_box_width_dim + \l__circledtext_box_height_dim + } + {% 指定高度为比例缩放 + \coffin_scale:Nnn \l__circledtext_box_coffin + { + \dim_ratio:nn { \l__circledtext_box_height_dim } + { \__circledtext_coffin_ht_plus_dp:N \l__circledtext_box_coffin } + } + { + \dim_ratio:nn { \l__circledtext_box_height_dim } + { \__circledtext_coffin_ht_plus_dp:N \l__circledtext_box_coffin } + } + } + {% 指定宽度为比例缩放 + \coffin_scale:Nnn \l__circledtext_box_coffin + { + \dim_ratio:nn { \l__circledtext_box_width_dim } + { \coffin_wd:N \l__circledtext_box_coffin } + } + { + \dim_ratio:nn { \l__circledtext_box_width_dim } + { \coffin_wd:N \l__circledtext_box_coffin } + } + } + {% 实际宽、高比例缩放 + \coffin_scale:Nnn \l__circledtext_box_coffin + { \l__circledtext_x_scale_tl } + { \l__circledtext_y_scale_tl } + } + } + +% 按基字符参数缩放 +\__circledtext_new_resize_method:nn { base } + { + \__circledtext_force_size_dispatch:nnnn + {% 按指定盒子宽高缩放 + \coffin_resize:Nnn \l__circledtext_box_coffin + \l__circledtext_box_width_dim + \l__circledtext_box_height_dim + } + {% 基字符宽高乘以高度比例缩放 + \coffin_resize:Nnn \l__circledtext_box_coffin + { + \l__circledtext_char_width_dim * \dim_ratio:nn { \l__circledtext_box_height_dim } + { \__circledtext_coffin_ht_plus_dp:N \l__circledtext_box_coffin } + } + { + \l__circledtext_box_height_dim + } + } + {% 基字符宽高乘以宽度比例缩放 + \coffin_resize:Nnn \l__circledtext_box_coffin + { + \l__circledtext_box_width_dim + } + { + \l__circledtext_char_height_dim * \dim_ratio:nn { \l__circledtext_box_width_dim } + { \coffin_wd:N \l__circledtext_box_coffin } + } + } + {% 基字符乘比例系数后缩放 + \coffin_resize:Nnn \l__circledtext_box_coffin + { + \l__circledtext_x_scale_tl \l__circledtext_char_width_dim + } + { + \l__circledtext_y_scale_tl \l__circledtext_char_height_dim + } + } + } +\msg_new:nnn { circledtext } { resize-type } { using~ `#1'~ resize. } + +% 笔画设置函数 +\cs_new:Npn \__circledtext_chars_stroke:nn #1#2 + { + \special { pdf:code ~ q ~ #1 } #2 \special { pdf:code ~ Q } + } +% 笔画构造函数 +\cs_new_protected:Npn \__circledtext_chars_stroke_construct:n #1 + { + \int_case:nn {\l__circledtext_charstroke_type_int} + { + {1}{ #1 } + {2}{ + \__circledtext_chars_stroke:nn { 1 ~ Tr ~ 0.10 ~ w ~ [] ~ 0 ~ d ~ 1 ~ J } {#1} + } + {3}{ + \__circledtext_chars_stroke:nn { 1 ~ Tr ~ 0.10 ~ w ~ [1~1] ~ 0 ~ d ~ 1 ~ J } {#1} + } + {4}{ + \__circledtext_chars_stroke:nn { 3 ~ Tr } {#1} + } + + } + } +\cs_generate_variant:Nn \__circledtext_chars_stroke_construct:n { V } +\cs_generate_variant:Nn \__circledtext_chars_stroke_construct:n { x } + +% key_value选项设计 +\keys_define:nn { circledtext } + { + % 基字符 + basechar .code:n = { \tl_gset:Nx \c__circledtext_basechar_tl {#1} + \__circledtext_calc_basechar_w_h: + }, + % 字符格式 + charf .code:n = { \tl_gset:Nn \l__circledtext_character_format_tl {#1} + \__circledtext_calc_char_box_size: + }, + % 边框类型 + boxtype .code:n = { \exp_args:NNx \clist_if_in:NnTF + \g__circledtext_char_box_list_clist {#1} + { \tl_set:Nx \l__circledtext_char_box_type_tl {#1} } + { \msg_error:nnx { circledtext } { box-exists } {#1} } + % \__circledtext_calc_char_box_size: + }, + % 缩放方式 + resize .code:n = { \exp_args:NNx \clist_if_in:NnTF + \g__circledtext_resize_method_clist {#1} + { \tl_set:Nx \l__circledtext_resize_method_tl {#1} } + { \msg_error:nnx { circledtext } { resize-method } {#1} } + }, + % 缩放参数 + xscale .tl_set:N = \l__circledtext_x_scale_tl , + xscale .initial:n = 1 , + yscale .tl_set:N = \l__circledtext_y_scale_tl , + yscale .initial:n = 1 , + scale .meta:n = { xscale = #1 , yscale = #1 } , + width .dim_set:N = \l__circledtext_box_width_dim , + height .dim_set:N = \l__circledtext_box_height_dim , + + % 字符边框线宽 + boxlinewidth .dim_set:N = \l__circledtext_box_linewidth_dim , + boxlinewidth .initial:n = 0.4pt , + % 十字线线宽 + crosslinewidth .dim_set:N = \l__circledtext_cross_linewidth_dim , + crosslinewidth .initial:n = 0.3pt , + + % 边框线颜色 + boxcolor .code:n = { \tl_set:Nx \l_tmpa_tl { + #1 ! \int_use:N \l__circledtext_cross_color_ratio_int } + \__circledtext_color_select:nn { circledtextcharboxcolor } {#1} + \__circledtext_color_select:nx { circledtextcrosscolor } + { \l_tmpa_tl } + } , + boxcolor .initial:n = black , + boxcolor* .code:n = { \tl_set:Nx \l_tmpa_tl { + #1 ! \int_use:N \l__circledtext_cross_color_ratio_int } + \__circledtext_color_select:nnn { circledtextcharboxcolor } #1 + \__circledtext_color_select:nnx { circledtextcrosscolor } + \l_tmpa_tl + } , + % 十字线颜色点边框颜色的比例(必须在boxcolor后) + crosscolorratio .code:n = { \int_set:Nn \l__circledtext_cross_color_ratio_int { #1 } + \__circledtext_color_select:nn { circledtextcrosscolor } + { circledtextcharboxcolor ! #1 } + }, + crosscolorratio .initial:n = 30, + + % 字符颜色 + charcolor .code:n = { \__circledtext_color_select:nn { circledtextcharcolor } {#1} } , + charcolor .initial:n = black , + charcolor* .code:n = { \__circledtext_color_select:nnn { circledtextcharcolor } #1 } , + color .meta:n = { boxcolor = #1, crosscolor = #1, charcolor = #1 } , + color* .meta:n = { boxcolor* = #1, crosscolor = #1, charcolor* = #1 } , + % 字符盒子背景填充颜色 + boxfill .code:n = { \exp_args:Nx \tl_if_empty:nTF {#1} + { \__circledtext_color_select:nn { circledtextboxfill } + { white } + \bool_if:NTF \l__circledtext_negative_bool, + {\cs_set_nopar:Npn \__circledtext_aux_color_boxfill: + { \color_fill:n { white } } + } + {\cs_set_nopar:Npn \__circledtext_aux_color_boxfill: { }} + }{ \__circledtext_color_select:nn { circledtextboxfill } {#1} + \cs_set_nopar:Npn \__circledtext_aux_color_boxfill: + { \color_fill:n {#1} } + } + } , + boxfill .initial:n = {} , + boxfill* .code:n = { \__circledtext_color_select:nnn { circledtextboxfill } #1 + \cs_set_nopar:Npn \__circledtext_aux_color_boxfill: + { \color_fill:nn #1 } + } , + % 笔画参数 + charstroke .choice:, + charstroke .value_required:n = true, + charstroke .choices:nn = + { none, solid, dashed, invisible } + { \int_set_eq:NN \l__circledtext_charstroke_type_int \l_keys_choice_int }, + charstroke .initial:n = none, + % 虚线样式 + dashpattern .tl_set:N = \l__circledtext_dash_pattern_tl , + dashpattern .initial:n = { } , + + unknown .code:n = { \msg_error:nn { circledtext } { unknown-option } } + } +\msg_new:nnn { circledtext } { unknown-option } + { package~ option~ "\l_keys_key_tl"~ is~ unknown. } + +% 根据编译引擎设置基字符 +\sys_if_engine_xetex:TF + { + \keys_set:nn { circledtext } + { + basechar = 好, + } + }{ + \sys_if_engine_luatex:TF + { + \keys_set:nn { circledtext } + { + basechar = 好, + } + }{ + \keys_set:nn { circledtext } + { + basechar = x, + } + } + } + +\keys_set:nn { circledtext } + { + charf = \normalsize, + boxtype = o, + resize = none, + } + +% 选项设置用户接口 +\NewDocumentCommand \circledtextset { m } + { \keys_set:nn { circledtext } {#1} } + +% 构建字符盒子,如字符为空,则用基字符构造 +% #1 需要处理的字符(串) +\cs_new:Npn \__circledtext_single_char_construct:N #1 + { + \tl_if_empty:NTF #1 + { + \hcoffin_set:Nn \l__circledtext_char_coffin + { + \__circledtext_single_handle:N \c__circledtext_basechar_tl + } + }{ + \hcoffin_set:Nn \l__circledtext_char_coffin + { + \__circledtext_single_handle:N #1 + } + } + } + +% 构建带圈文字内部函数 +% #1 选项内容 +% #2 需要处理的字符(串) +\cs_new:Npn \__circledtext_handle:nn #1#2 + { + \group_begin: + % 选项设置 + \keys_set:nn { circledtext } { #1 } + + % 设置字符串 + \tl_gset:Nx \l__circledtext_chars_tl {#2} + + % 构造盒子 + \__circledtext_single_char_construct:N \l__circledtext_chars_tl + + % 复制盒子准备缩放与输出 + \coffin_set_eq:NN \l__circledtext_box_coffin \l__circledtext_char_coffin + + % 测量盒子容器总高度 + \dim_set:Nn \l_tmpa_dim + { \__circledtext_coffin_ht_plus_dp:N \l__circledtext_box_coffin } + % 缩放字符盒子容器到字符大小 + \coffin_scale:Nnn \l__circledtext_box_coffin + { + \dim_ratio:nn { \charboxht } { \l_tmpa_dim } + } + { + \dim_ratio:nn { \charboxht } { \l_tmpa_dim } + } + + % 根据指定的方式缩放盒子 + \__circledtext_resize_c:n { \l__circledtext_resize_method_tl } + + % 输出盒子(下沉深度距离) + \coffin_typeset:Nnnnn \l__circledtext_box_coffin + { l } { b } { 0pt } { -\l__circledtext_char_dp_dim } + \group_end: + } + +% 字符处理句柄函数 +% #1 需要处理的字符(串)变量 +\cs_new:Npn \__circledtext_single_handle:N #1 + { + \group_begin: + \tl_set:Nf \l__circledtext_curr_char_tl {#1} + \__circledtext_single_construct:N \l__circledtext_curr_char_tl + \group_end: + } + +% 构造带圈字符 +% #1 需要处理的字符(串)变量 +\cs_new:Npn \__circledtext_single_construct:N #1 + { + % 按指定的格式和内容构造一个字符盒子容器 + \hcoffin_set:Nn \l__circledtext_box_coffin + { + % \cs_if_eq:NNTF \__circledtext_aux_color_boxfill: \c_empty_tl + % { + % \color_select:n { circledtextcharcolor } + % }{ + \bool_if:NTF \l__circledtext_negative_bool + { + \color_select:n { circledtextboxfill } + }{ + \color_select:n { circledtextcharcolor } + } + % } + \tl_use:N \l__circledtext_character_format_tl + \__circledtext_chars_stroke_construct:n { #1 } + } + + % 构造字符盒子容器边框 + \__circledtext_single_box_construct: + } + +% 字符盒子及边框组合盒子容器构造函数 +\cs_new:Npn \__circledtext_single_box_construct: + { + % 根据文字内容计算缩放比例 + \dim_set:Nn \l_tmpa_dim + { \coffin_wd:N \l__circledtext_box_coffin } + \dim_set:Nn \l_tmpb_dim + { \__circledtext_coffin_ht_plus_dp:N \l__circledtext_box_coffin } + \dim_compare:nNnF \l_tmpa_dim > \l_tmpb_dim + { + \dim_set_eq:NN \l_tmpa_dim \l_tmpb_dim + } + + % 缩放字符盒子容器 + \coffin_scale:Nnn \l__circledtext_box_coffin + { + \dim_ratio:nn { \charboxwd } { \l_tmpa_dim } + } + { + \dim_ratio:nn { \charboxht } { \l_tmpa_dim } + } + + % 如果是矩形外框,则适当缩小文字 + \clist_if_in:nVT {O,O+,OX,OX+,X+} \l__circledtext_char_box_type_tl + { + \coffin_scale:Nnn \l__circledtext_box_coffin + { 0.75 } { 0.75 } + } + + % 绘制外框并拼装结果 + \draw_begin: + \draw_linewidth:n { \l__circledtext_box_linewidth_dim } + + \draw_path_scope_begin: + \__circledtext_char_box_type_c:n { \l__circledtext_char_box_type_tl } + { 0 } { 0 } { \charboxwd } { \charboxht } { 1.0 } { 1.0 } + \draw_transform_shift:n {\charboxwd / 2.0, \charboxht / 2.0 } + \draw_coffin_use:Nnn \l__circledtext_box_coffin { hc } { vc } + \draw_path_scope_end: + \draw_end: + } + +\endinput diff --git a/macros/latex/contrib/circledtext/circledtext.tex b/macros/latex/contrib/circledtext/circledtext.tex new file mode 100644 index 0000000000..ec6201932e --- /dev/null +++ b/macros/latex/contrib/circledtext/circledtext.tex @@ -0,0 +1,749 @@ +\documentclass[full]{l3doc} +\usepackage[scheme=plain]{ctex} +\usepackage{enumitem} +\usepackage{indentfirst} +\usepackage{titling} +\usepackage{geometry} +\usepackage{fancyvrb-ex} +\usepackage{circledtext} + +\IndexPrologue + { + \section*{Index} + \markboth{Index}{Index} + \addcontentsline{toc}{section}{Index} + The~italic~numbers~denote~the~pages~where~the~ + corresponding~entry~is~described,~ + numbers~underlined~point~to~the~definition,~ + all~others~indicate~the~places~where~it~is~used. + } + +\newcommand\tikzmark[1]{\tikz \coordinate[overlay, remember picture] (#1);} + +\geometry{ + left=4.5cm, + right=2cm, + top=2cm, + bottom=2cm, +} +\hypersetup { + CJKbookmarks, + bookmarksopen, + bookmarksopenlevel=3, + pdfstartview=FitH, + pdfinfo = { + Title = The package circledtext , + Subject = A LaTeX3 package , + Author = Geng Nan + } +} + +\DoNotIndex{\begin, \end} +\setlength{\parskip}{\medskipamount} +\DeclareDocumentEnvironment { noteen } { +b } { + \par\textbf{\textsf{NOTE:~}}#1\par +} {} +\DeclareDocumentEnvironment { notezh } { +b } { + \par\textbf{\textsf{注意:~}}#1\par +} {} + +\AtEndDocument{ + \newgeometry{ + left=2cm, + right=2cm, + top=2cm, + bottom=2cm + } + \PrintIndex +} + +\ExplSyntaxOn +\dim_new:N \l__my_syntax_dim +\box_new:N \g__my_syntax_box +\NewDocumentEnvironment { Syntax } { s } + { + \dim_set:Nn \l__my_syntax_dim + { \textwidth } + \hbox_gset:Nw \g__my_syntax_box + \small \ttfamily + \begin{minipage}[t]{\l__my_syntax_dim} + \raggedright\obeyspaces\obeylines + } + { + \end{minipage} + \hbox_gset_end: + \IfValueF { #1 } { \smallskip } + \box_use_drop:N \g__my_syntax_box + \smallskip + } + +\DeclareDocumentEnvironment { Description } { o +b } { + \hbox_set:Nn \l_tmpa_box { #1 } + \dim_set:Nn \l_tmpa_dim { \box_wd:N \l_tmpa_box } + \begin{itemize}[labelwidth=\l_tmpa_dim, align=left] + #2 + \end{itemize} +} { } + +\keys_define:nn { circled/doc } { + opt .tl_set:N = \l_opt_tl, + desc .tl_set:N = \l_desc_tl, + init .tl_set:N = \l_init_tl, + init .initial:n = init-none, +} + +\box_new:N \l__option_box +\NewDocumentEnvironment { option } { m +b } { + \keys_set:nn { circled/doc } { #1 } + \hbox_set:Nw \l__option_box + \small \ttfamily + \begin{minipage}[t]{\textwidth} + \obeyspaces\obeylines + \textcolor{red}{ + \l_opt_tl + \exp_args:Nx\SpecialOptionIndex{\l_opt_tl} + } + {~}\l_desc_tl + \hfill( + \tl_if_eq:NnTF \l_init_tl { init-none } { no~value } + { initially~\texttt{\l_init_tl} } + ) + \end{minipage} + \hbox_gset_end: + \box_use_drop:N \l__option_box + #2 + \medskip +} { } + +\DeclareDocumentCommand \opt { O{} m } + { \__codedoc_cmd:no {#1} { #2 } } +\ExplSyntaxOff + +\def\vers{\texttt{v1.0.0} } + +\begin{document} +\title{ + \circledtext[charf=\LARGE]{带}\circledtext[charf=\LARGE]{圈}% + 文字排版\\\pkg{circledtext} 宏包 + \rlap{\makebox[4cm][r]{ + \normalsize $\Longrightarrow$ \color{red} + \protect\hyperlink{en}{English Version} + \protect\hypertarget{zh}{} + }} +} +\author{\textit{耿楠} \texttt{<nangeng@nwafu.edu.cn>}} +\date{\the\year 年\the\month 月\the\day 日\qquad \vers +\thanks{\url{https://github.com/registor/circledtext}} +\thanks{\url{https://gitee.com/nwafu_nan/circledtext}} +} +\maketitle + +{\small +\tableofcontents +} +\newpage + +\begin{documentation} + +\section{引言} + +\pkg{circledtext}是一个基于\pkg{l3draw}用\pkg{expl3}开发的 +排版带圈文字的宏包,它提供了唯一的一个排版命令\tn{circledtext}% +用于对其必选参数中的字符(串)按指定的基字符大小缩放后,再为其添加 +圆形边框,然后排版输出。其带星号``*''命令\tn{circledtext*}用于 +实现反色阴文排版输出。可以通过该命令的命令选项或\tn{circledtextset}% +命令设置排版输出的不同外观。 + +\section{用户接口} + +\subsection{\cs{circledtext}排版命令} + +\begin{function}{\circledtext} + \begin{syntax} + \cs{circledtext} \oarg{外观选项} \marg{字符(串)} + \end{syntax} +\end{function} + + 按设置的\oarg{外观选项}对指定的\marg{字符(串)}添加圆圈后排版输出。 + + 该命令仅有一个必选参数\marg{字符(串)},用于指定需要排版的文本。 + + 在\oarg{外观选项}中可以通过key-value的方式设置颜色、字体、字号、线宽等外观。 + + 外观也可以通过\cs{circledtextset}命令,以逗号分隔key-value列表进行设置。 + + 通过\oarg{外观选项}设置的外观参数仅对当前命令局部有效, + 通过\cs{circledtextset}命令设置的外观参数对后续所有命令有效。 + + 其星号版本命令用于反色阴文输出。 + +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtext{五}\quad + \circledtext{888}\quad + \circledtext*{五}\quad + \circledtext*{888} +\end{SideBySideExample} + +\subsection{\cs{circledtextset}外观选项设置命令} + +\begin{function}{\circledtextset} + \begin{syntax} + \cs{circledtextset} \marg{外观选项} + \end{syntax} +\end{function} + + 用于设置一个外围圆圈及字符(串)的外观。 + + 在\marg{外观选项}中可以通过key-value方式设置颜色、 + 字体、字号、线宽等外观。 + + 通过\cs{circledtextset}命令设置的外观参数对后续所有命令有效。 + +\section{外观选项} + +\begin{option}{ opt = basechar, desc = {= \meta{基字符}}, init=好/x } + 设置尺寸测度基字符,如果使用|xetex|或|luatex|引擎编译 + 则初始值为中文“好”字,否则使用英文``x''。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtext{五}\quad + \circledtext{一佰}\quad + \circledtext[basechar=m]{999} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = charf, desc = {= \meta{格式命令}}, init=\tn{normalsize} } + 设置字符(串)格式,初始值为\tn{normalsize}。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtext{五}\qquad + \circledtext[charf=\Huge\sffamily]{九} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = boxtype, desc = {= \meta{外框类型}}, init=o } + 设置外框类型,目前支持: +\end{option}\\ + \begin{Description} + \item |o|---实心填充圆(小写英文字母``o'')。 + \item |o+|---十字填充圆。 + \item |ox|---对角十字填充圆(小写英文字母``x'')。 + \item |ox+|---米字填充圆。 + \item |x+|---米字填充背景。 + \item |O|---实心填充正方形(大写英文字母``O'')。 + \item |O+|---十字填充正方形。 + \item |OX|---对角十字填充正方形(小写英文字母``X'')。 + \item |OX+|---米字填充正方形。 + \item |X+|---米字填充背景。 + \end{Description} +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] + \centering + \circledtext[boxtype=o ]{甲}\quad + \circledtext[boxtype=o+ ]{乙}\quad + \circledtext[boxtype=ox ]{丙}\quad + \circledtext[boxtype=ox+]{丁}\quad + \circledtext[boxtype=x+ ]{戊} +\end{SideBySideExample} + +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] + \centering + \circledtext[boxtype=O ]{甲}\quad + \circledtext[boxtype=O+ ]{乙}\quad + \circledtext[boxtype=OX ]{丙}\quad + \circledtext[boxtype=OX+]{丁}\quad + \circledtext[boxtype=X+ ]{戊} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = resize, desc = {= \meta{缩放方式}}, init=none } + 设置缩放类型,目前支持: +\end{option}\\ +\begin{Description} + \item |none|---无缩放。 + \item |real|---使用字符实际宽高缩放。 + \item |base|---使用基字符缩放。 +\end{Description} +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{width=2cm} + \circledtext[resize=none]{10}\quad + \circledtext[resize=real]{15}\quad + \circledtext[resize=base]{20} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = xscale, desc = {= \meta{x方向缩放系数}}, init=1 } + 设置x方向缩放系数。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{resize=real} + \circledtext[xscale=0.5]{15}\quad + \circledtext[xscale=1.0]{15}\quad + \circledtext[xscale=1.5]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = yscale, desc = {= \meta{y方向缩放系数}}, init=1 } + 设置y方向缩放系数。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{resize=real} + \circledtext[yscale=0.5]{15}\quad + \circledtext[yscale=1.0]{15}\quad + \circledtext[yscale=1.5]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = width, desc = {= \meta{宽度}}, init=无 } + 设置宽度。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{resize=real} + \circledtext[width=0.5em]{15}\quad + \circledtext[width=1.0em]{15}\quad + \circledtext[width=1.5em]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = height, desc = {= \meta{高度}}, init=无 } + 设置高度。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{resize=real} + \circledtext[height=1.0ex]{15}\quad + \circledtext[height=2.0ex]{15}\quad + \circledtext[height=3.0ex]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = boxlinewidth, desc = {= \meta{边框线宽}}, init=0.4pt } + 设置边框线宽。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.44\linewidth,gobble=2] + \centering + \circledtext{100}\quad + \circledtext[boxlinewidth=1.0pt]{1000}\quad + \circledtext[boxlinewidth=2.0pt]{一佰三十} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = crosslinewidth, desc = {= \meta{背景线线宽}}, init=0.3pt } + 设置背景线线宽。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.44\linewidth,gobble=2] + \centering + \circledtextset{boxtype=o+} + \circledtext{三}\quad + \circledtext[crosslinewidth=1.0pt]{三}\quad + \circledtext[crosslinewidth=2.0pt]{三} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = crosscolorratio, desc = {= \meta{背景线颜色比例}}, init=30 } + 设置背景线颜色点边框颜色的比例(\%)。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.38\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,crosslinewidth=2pt} + \circledtext[crosscolorratio=10]{15}\quad + \circledtext[crosscolorratio=80]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = boxcolor, desc = {= \meta{边框颜色}}, init=black } + 设置边框颜色。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+} + \circledtext{15}\quad + \circledtext[boxcolor=red]{15}\quad + \circledtext[boxcolor=blue]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = charcolor, desc = {= \meta{字符(串)颜色}}, init=black } + 设置字符(串)颜色。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,boxcolor=red} + \circledtext{15}\quad + \circledtext[charcolor=red]{15}\quad + \circledtext[charcolor=blue]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = boxfill, desc = {= \meta{背景颜色}}, init=无 } + 设置背景填充颜色。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,boxcolor=red} + \circledtext{15}\quad + \circledtext[boxfill=red!30]{15}\quad + \circledtext[boxfill=blue!30]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = charstroke, desc = {= \meta{笔画类型}}, init=无 } + 设置字符(串)笔画类型。 +\end{option}\\ +\begin{Description} + \item |none|---原始笔画轮廓。 + \item |solid|---实线笔画轮廓。 + \item |dashed|---虚线笔画轮廓。 + \item |invisible|---隐藏笔画轮廓。 +\end{Description} +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,boxcolor=red, + charf=\sffamily\bfseries\Huge} + \circledtext{五}\quad + \circledtext[charstroke=solid]{五}\quad + \circledtext[charstroke=dashed]{五}\quad + \circledtext[charstroke=invisible]{五} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = dashpattern, desc = {= \meta{背景线线型}}, init=无 } + 设置背景线线型。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,boxcolor=red, + charstroke=invisible,charf=\Huge} + \circledtext{五}\quad + \circledtext[dashpattern={1.5mm,1mm,2mm,1.5mm}]{五} +\end{SideBySideExample} + +\title{ + \circledtext{C}ircled\circledtext{T}ext Package \pkg{circledtext} + \rlap{\makebox[4cm][r]{ + \normalsize $\Longrightarrow$ \color{red} + \protect\hyperlink{zh}{中文版本} + \protect\hypertarget{en}{} + }} +} +\author{Nan Geng \texttt{<nangeng@nwafu.edu.cn>}} +\date{\today\qquad \vers} +\maketitle + +\section{Introduction} + +\pkg{circledtext} is a text with circle package based on% +\pkg{l3draw} by \pkg{expl3}. This package provides a macro +\tn{circledtext} to create arbitrary ``circled'' text. The +starred macro can create negative ``circled'' text. +a macro \tn{circledtextset} to set the format of ``circled'' +text. + +\section{Inerface} + +\subsection{\cs{circledtext} macro} + +\begin{function}{\circledtext} + \begin{syntax} + \cs{circledtext} \oarg{options} \marg{text} + \end{syntax} +\end{function} + + According to \oarg{options} to create ``circled'' + \marg{text}. + + \oarg{options} are key-value for color, font, size and so on.。 + + Macro's \oarg{options} are local setting. + + If global settings are needed, the \cs{circledtextset} macro is required. + + The starred version can create negative ``circled'' text. + +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtext{8}\quad + \circledtext{888}\quad + \circledtext*{8}\quad + \circledtext*{888} +\end{SideBySideExample} +\subsection{\cs{circledtextset} macro} + +\begin{function}{\circledtextset} + \begin{syntax} + \cs{circledtextset} \marg{options} + \end{syntax} +\end{function} + + Used to set the appearance of ``circled'' text. + + In \marg{options} you can set the appearance of the + color, font, size, linewidth, etc. by key-value lists. + + The appearance seted by the \cs{circledtextset} are + valid for all subsequent macros. + +\section{options} + +\begin{option}{ opt = basechar, desc = {= \meta{base char}}, init=好/x } + Set size measurement base character. If compiled with xetex or luatex engine, + the initial value is ``好'' in Chinese, otherwise the initial value is the + letter ``x'' in English. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtext{8}\quad + \circledtext{100}\quad + \circledtext[basechar=m]{three} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = charf, desc = {= \meta{format macro(s)}}, init=\tn{normalsize} } + Set text formats. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtext{8}\qquad + \circledtext[charf=\Huge\sffamily]{9} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = boxtype, desc = {= \meta{box type}}, init=o } + Set box type, currently as follows: +\end{option}\\ + \begin{Description} + \item |o|---filled circle(lowercase "o"). + \item |o+|---filled circle with cross. + \item |ox|---filled circle with diagonal cross(lowercase "x"). + \item |ox+|---filled circle with diagonal cross and cross. + \item |x+|---diagonal cross and cross. + \item |O|---filled circle(capital "O"). + \item |O+|---filled circle with cross. + \item |OX|---filled circle with diagonal cross(capital "X"). + \item |OX+|---filled circle with diagonal cross and cross. + \item |X+|---diagonal cross and cross. + \end{Description} +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] + \centering + \circledtext[boxtype=o ]{10}\quad + \circledtext[boxtype=o+ ]{11}\quad + \circledtext[boxtype=ox ]{12}\quad + \circledtext[boxtype=ox+]{13}\quad + \circledtext[boxtype=x+ ]{14} +\end{SideBySideExample} + +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] + \centering + \circledtext[boxtype=O ]{10}\quad + \circledtext[boxtype=O+ ]{11}\quad + \circledtext[boxtype=OX ]{12}\quad + \circledtext[boxtype=OX+]{13}\quad + \circledtext[boxtype=X+ ]{14} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = resize, desc = {= \meta{resize type}}, init=none } + Set resize type, currently as follows: +\end{option}\\ +\begin{Description} + \item |none|---No scaling. + \item |real|---Scaling with real size or ratio. + \item |base|---Scaling with base size. +\end{Description} +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{width=2cm} + \circledtext[resize=none]{10}\quad + \circledtext[resize=real]{15}\quad + \circledtext[resize=base]{20} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = xscale, desc = {= \meta{x factor}}, init=1 } + Set x-direction scaling factor. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{resize=real} + \circledtext[xscale=0.5]{15}\quad + \circledtext[xscale=1.0]{15}\quad + \circledtext[xscale=1.5]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = yscale, desc = {= \meta{y factor}}, init=1 } + Set y-direction scaling factor. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{resize=real} + \circledtext[yscale=0.5]{15}\quad + \circledtext[yscale=1.0]{15}\quad + \circledtext[yscale=1.5]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = width, desc = {= \meta{width}}, init=null } + Set width. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{resize=real} + \circledtext[width=0.5em]{15}\quad + \circledtext[width=1.0em]{15}\quad + \circledtext[width=1.5em]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = height, desc = {= \meta{height}}, init=null } + Set height. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{resize=real} + \circledtext[height=1.0ex]{15}\quad + \circledtext[height=2.0ex]{15}\quad + \circledtext[height=3.0ex]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = boxlinewidth, desc = {= \meta{line width}}, init=0.4pt } + Set box line width. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.44\linewidth,gobble=2] + \centering + \circledtext{100}\quad + \circledtext[boxlinewidth=1.0pt]{1000}\quad + \circledtext[boxlinewidth=2.0pt]{one} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = crosslinewidth, desc = {= \meta{cross width}}, init=0.3pt } + Set cross line width. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.44\linewidth,gobble=2] + \centering + \circledtextset{boxtype=o+} + \circledtext{8}\quad + \circledtext[crosslinewidth=1.0pt]{8}\quad + \circledtext[crosslinewidth=2.0pt]{8} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = crosscolorratio, desc = {= \meta{bg}}, init=30 } + Set the ratio of the cross line color to box color(\%). +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.38\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,crosslinewidth=2pt} + \circledtext[crosscolorratio=10]{15}\quad + \circledtext[crosscolorratio=80]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = boxcolor, desc = {= \meta{box color}}, init=black } + Set box color. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+} + \circledtext{15}\quad + \circledtext[boxcolor=red]{15}\quad + \circledtext[boxcolor=blue]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = charcolor, desc = {= \meta{text color}}, init=black } + Set text color. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,boxcolor=red} + \circledtext{15}\quad + \circledtext[charcolor=red]{15}\quad + \circledtext[charcolor=blue]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = boxfill, desc = {= \meta{fill color}}, init=null } + Set fill color. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,boxcolor=red} + \circledtext{15}\quad + \circledtext[boxfill=red!30]{15}\quad + \circledtext[boxfill=blue!30]{15} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = charstroke, desc = {= \meta{stroke}}, init=none } + Set character stroke type. +\end{option}\\ +\begin{Description} + \item |none|---Original stroke. + \item |solid|---Solid stroke. + \item |dashed|---dashed stroke. + \item |invisible|---Hide stroke. +\end{Description} +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,boxcolor=red, + charf=\sffamily\bfseries\Huge} + \circledtext{8}\quad + \circledtext[charstroke=solid]{8}\quad + \circledtext[charstroke=dashed]{8}\quad + \circledtext[charstroke=invisible]{8} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = dashpattern, desc = {= \meta{cross style}}, init=null } + Set cross style. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=2] + \centering + \circledtextset{boxtype=ox+,boxcolor=red, + charstroke=invisible,charf=\Huge} + \circledtext{8}\quad + \circledtext[dashpattern={1.5mm,1mm,2mm,1.5mm}]{8} +\end{SideBySideExample} + +\end{documentation} + +\end{document} diff --git a/macros/latex/contrib/colorist/colorart.cls b/macros/latex/contrib/colorist/colorart.cls index b90308c016..b347658bbb 100644 --- a/macros/latex/contrib/colorist/colorart.cls +++ b/macros/latex/contrib/colorist/colorart.cls @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplClass {colorart} - {2022/04/17} {} + {2022/04/24} {} {A colorful article style} \tl_const:Nn \l__colorclass_base_class_tl { article } @@ -84,6 +84,7 @@ total = { 6.500in, 9.130in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } \bool_if:NT \l__colorclass_b_five_paper_bool @@ -94,6 +95,7 @@ total = { 5.535in, 8.160in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } } @@ -105,6 +107,7 @@ total = { 6.500in, 9.685in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } } @@ -168,7 +171,24 @@ \PassOptionsToPackage { all } { nowidow } \RequirePackage { nowidow } -\RequirePackage { embrac } + +\RequirePackage { regexpatch } +\skip_new:N \g_colorclass_parfillskip_skip +\xpatchcmd{\@trivlist}{\@flushglue}{\g_colorclass_parfillskip_skip}{}{} +\hook_gput_code:nnn { begindocument } { colorclass } + { + \skip_gset:Nn \g_colorclass_parfillskip_skip { 0pt plus \dim_eval:n { \linewidth - 2\parindent } } + \skip_gset_eq:NN \parfillskip \g_colorclass_parfillskip_skip + } + +\hook_gput_code:nnn { begindocument/before } { colorclass } + { + \@ifpackageloaded { biblatex } + { + \PassOptionsToPackage { biblatex } { embrac } + } {} + \RequirePackage { embrac } + } %%================================ %% Graphics diff --git a/macros/latex/contrib/colorist/colorbook.cls b/macros/latex/contrib/colorist/colorbook.cls index 2e5bd693d2..2fe78fc5f3 100644 --- a/macros/latex/contrib/colorist/colorbook.cls +++ b/macros/latex/contrib/colorist/colorbook.cls @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplClass {colorbook} - {2022/04/17} {} + {2022/04/24} {} {A colorful book style} \tl_const:Nn \l__colorclass_base_class_tl { book } @@ -84,6 +84,7 @@ total = { 6.500in, 9.130in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } \bool_if:NT \l__colorclass_b_five_paper_bool @@ -94,6 +95,7 @@ total = { 5.535in, 8.160in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } } @@ -105,6 +107,7 @@ total = { 6.500in, 9.685in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } } @@ -168,7 +171,24 @@ \PassOptionsToPackage { all } { nowidow } \RequirePackage { nowidow } -\RequirePackage { embrac } + +\RequirePackage { regexpatch } +\skip_new:N \g_colorclass_parfillskip_skip +\xpatchcmd{\@trivlist}{\@flushglue}{\g_colorclass_parfillskip_skip}{}{} +\hook_gput_code:nnn { begindocument } { colorclass } + { + \skip_gset:Nn \g_colorclass_parfillskip_skip { 0pt plus \dim_eval:n { \linewidth - 2\parindent } } + \skip_gset_eq:NN \parfillskip \g_colorclass_parfillskip_skip + } + +\hook_gput_code:nnn { begindocument/before } { colorclass } + { + \@ifpackageloaded { biblatex } + { + \PassOptionsToPackage { biblatex } { embrac } + } {} + \RequirePackage { embrac } + } %%================================ %% Graphics diff --git a/macros/latex/contrib/colorist/colorist-doc.pdf b/macros/latex/contrib/colorist/colorist-doc.pdf Binary files differindex 2832b0bf7c..017bc0e7d3 100644 --- a/macros/latex/contrib/colorist/colorist-doc.pdf +++ b/macros/latex/contrib/colorist/colorist-doc.pdf diff --git a/macros/latex/contrib/colorist/colorist-doc.tex b/macros/latex/contrib/colorist/colorist-doc.tex index b6b7f696fa..d52ff27fdc 100644 --- a/macros/latex/contrib/colorist/colorist-doc.tex +++ b/macros/latex/contrib/colorist/colorist-doc.tex @@ -93,7 +93,7 @@ %%================================ \begin{document} -\def\PackageVersion{2022/04/17} +\def\PackageVersion{2022/04/24} \title{{\normalfont\bfseries\color{main-text}\colorist{}}\\write your articles or books in a colorful way} \author{Jinwen XU} diff --git a/macros/latex/contrib/colorist/colorist-fancy.sty b/macros/latex/contrib/colorist/colorist-fancy.sty index f604f3ff47..8f0d97307a 100644 --- a/macros/latex/contrib/colorist/colorist-fancy.sty +++ b/macros/latex/contrib/colorist/colorist-fancy.sty @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {colorist-fancy} - {2022/04/17} {} + {2022/04/24} {} {The fancy style of colorist} \@ifpackageloaded { colorist } {} @@ -211,7 +211,7 @@ %%================================ %% Title format %%================================ -\RequirePackage [ explicit, newparttoc, nobottomtitles ] { titlesec } +\RequirePackage [ explicit, newparttoc, nobottomtitles* ] { titlesec } \PassOptionsToPackage { normalem } { ulem } \RequirePackage { ulem } @@ -394,7 +394,7 @@ %% Paragraph \titleformat{\paragraph}[runin] - { \g_colorist_title_font_paragraph_tl }{\theparagraph}{1em}{#1} + {\color{main-text!50!paper} \g_colorist_title_font_paragraph_tl }{\theparagraph}{1em}{#1} \titlespacing{\section}{0pt}{\baselineskip}{.6\baselineskip} \titlespacing{\subsection}{0pt}{.75\baselineskip}{.4\baselineskip} @@ -653,9 +653,13 @@ heading_suffix "}\n" {}{} {\normalfont}{} {\normalfont}{} - {\newline} - {{\thmname{#1}\nobreakspace\thmnumber{#2}} - {\color{main-text!50!paper}\thmnote{\hspace{.4em}$($#3$)$}}\smallskip} + {0pt} + { + \rlap{\vbox{\hbox{\parbox{\linewidth}{ + {\thmname{#1}\thmnumber{\nobreakspace #2}} + {\color{main-text!50!paper}\thmnote{\hspace{.4em}$($#3$)$}} + }}\hbox{\strut}\vspace{-2\parskip}}} + } } { \newtheoremstyle{simple} @@ -674,10 +678,16 @@ heading_suffix "}\n" \bool_if:NTF \l__colorist_theorem_in_new_line_bool { \newtheoremstyle{basic} - {0pt}{0pt}{\normalfont}{0pt} - {}{\;}{\newline} - {{\thmname{#1}\nobreakspace\thmnumber{\textup{#2}}} - \thmnote{\normalfont\sffamily\color{main-text}\nobreakspace(#3)}\smallskip} + {}{} + {\normalfont}{} + {}{} + {0pt} + { + \rlap{\vbox{\hbox{\parbox{\linewidth}{ + {\thmname{#1}\nobreakspace\thmnumber{\textup{#2}}} + \thmnote{\normalfont\sffamily\color{main-text}\nobreakspace(#3)} + }}\hbox{\strut}\vspace{-2\parskip}}} + } } { \newtheoremstyle{basic} @@ -734,7 +744,7 @@ heading_suffix "}\n" \tl_gset:Nn \g_crthm_combined_name_sep_tl { \textcolor{main-text}{-} } -\SetTheorem { theorem, lemma, proposition, corollary, property, axiom, definition-theorem, definition-proposition } +\SetTheorem { theorem, lemma, proposition, corollary, property, axiom, construction, definition-theorem, definition-proposition } { name style = { heading style = { \color{orange}\colorist_bfseries:\g_colorist_title_font_common_tl\textsc } @@ -748,7 +758,7 @@ heading_suffix "}\n" } } -\SetTheorem { application, fact, example, problem, question, exercise } +\SetTheorem { application, claim, example, exercise, fact, problem, question, recall } { name style = { heading style = { \color{main-text}\colorist_bfseries:\g_colorist_title_font_common_tl\textsc } @@ -764,7 +774,7 @@ heading_suffix "}\n" \bool_if:NF \l__projlib_theorem_complexname_bool { - \SetTheorem { theorem, lemma, proposition, corollary, property, axiom, definition-theorem, definition-proposition } + \SetTheorem { theorem, lemma, proposition, corollary, property, axiom, construction, definition-theorem, definition-proposition } { name style = { , crefname style = { \color{orange}\colorist_bfseries:\g_colorist_title_font_common_tl\textsc } @@ -782,7 +792,7 @@ heading_suffix "}\n" } } - \SetTheorem { application, fact, example, problem, question, exercise } + \SetTheorem { application, claim, example, exercise, fact, problem, question, recall } { name style = { , crefname style = { \color{main-text}\colorist_bfseries:\g_colorist_title_font_common_tl\textsc } @@ -803,11 +813,10 @@ heading_suffix "}\n" \RequirePackage { marginnote } \RequirePackage { ifoddpage } -\newcommand{\mparadjust}[1]{\renewcommand*{\marginnotevadjust}{#1}} -\hook_gput_code:nnn { begindocument/before } { colorist } -{ - % -} +\cs_new_protected:Nn \colorist_mpar_adjust:n + { + \renewcommand* { \marginnotevadjust } { #1 } + } \hook_gput_code:nnn { env/remark/begin } { colorist } { \if@twoside\checkoddpage @@ -815,7 +824,7 @@ heading_suffix "}\n" \else \reversemarginpar \fi - \mparadjust{-.25em} + \colorist_mpar_adjust:n {-.25em} \marginnote{ \colorist_icon_ideabulb:w [0.3] {orange} \bool_if:NTF \l__colorist_is_book_bool @@ -835,7 +844,14 @@ heading_suffix "}\n" \else \reversemarginpar \fi - \mparadjust{-.25em} + \bool_if:NTF \l__colorist_theorem_in_new_line_bool + { + \colorist_mpar_adjust:n {-.75em} + \null + } + { + \colorist_mpar_adjust:n {-.25em} + } \marginnote{ \colorist_icon_questionmark:w [0.3] {purple} \bool_if:NTF \l__colorist_is_book_bool @@ -900,7 +916,7 @@ heading_suffix "}\n" \tcolorboxenvironment { #1 } { #2 } } -\colorist_add_colorbox:nn { theorem, lemma, proposition, corollary, property, axiom, definition-proposition, definition-theorem } +\colorist_add_colorbox:nn { theorem, lemma, proposition, corollary, property, axiom, construction, definition-proposition, definition-theorem } { enhanced~jigsaw, breakable, lines~before~break=3, left=3.5mm, right=3.5mm, @@ -916,7 +932,7 @@ heading_suffix "}\n" borderline~west={1.5mm}{0mm}{forestgreen}, arc=.7mm } -\colorist_add_colorbox:nn { application, fact, example } +\colorist_add_colorbox:nn { application, claim, example, fact, recall } { enhanced~jigsaw, breakable, lines~before~break=3, colback=main-text!5!paper, @@ -1037,7 +1053,8 @@ heading_suffix "}\n" % nobeforeafter, left = 1em, right=0mm, top=.5mm, bottom=0mm, boxrule=0pt, colback=maintheme!3!paper, frame ~ hidden, - borderline ~ west = {.3em} {0mm} {maintheme!90!paper}, arc = 0.2mm, + borderline ~ west = {.15em} {0mm} {maintheme, double, double ~ distance=.12em}, + arc = 0.2mm, ] } { diff --git a/macros/latex/contrib/colorist/colorist.sty b/macros/latex/contrib/colorist/colorist.sty index 2e28c650ad..24f6910e3f 100644 --- a/macros/latex/contrib/colorist/colorist.sty +++ b/macros/latex/contrib/colorist/colorist.sty @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {colorist} - {2022/04/17} {} + {2022/04/24} {} {A colorful style for articles and books} \keys_define:nn { colorist } diff --git a/macros/latex/contrib/crefthe/crefthe-doc.pdf b/macros/latex/contrib/crefthe/crefthe-doc.pdf Binary files differindex 2b94169807..16dea32970 100644 --- a/macros/latex/contrib/crefthe/crefthe-doc.pdf +++ b/macros/latex/contrib/crefthe/crefthe-doc.pdf diff --git a/macros/latex/contrib/crefthe/crefthe-doc.tex b/macros/latex/contrib/crefthe/crefthe-doc.tex index bd9ebed23b..e7bb3e0977 100644 --- a/macros/latex/contrib/crefthe/crefthe-doc.tex +++ b/macros/latex/contrib/crefthe/crefthe-doc.tex @@ -9,51 +9,66 @@ %% For typesetting code %%================================ \usepackage{listings} -\definecolor{maintheme}{RGB}{70,130,180} -\definecolor{forestgreen}{RGB}{21,122,81} -\definecolor{lightergray}{gray}{0.99} -\lstset{language=[LaTeX]TeX, - keywordstyle=\color{maintheme}, - basicstyle=\ttfamily, - commentstyle=\color{forestgreen}\ttfamily, - stringstyle=\rmfamily, - showstringspaces=false, - breaklines=true, - frame=lines, - backgroundcolor=\color{lightergray}, - flexiblecolumns=true, - escapeinside={(*}{*)}, - % numbers=left, - numberstyle=\scriptsize, stepnumber=1, numbersep=5pt, - % firstnumber=last, +\usepackage{xcolor} +\usepackage{setspace} +\definecolor{code-main}{RGB}{70,130,180} +\definecolor{code-expl3}{RGB}{240,50,60} +\definecolor{code-option}{RGB}{40,110,20} +\definecolor{code-keys}{RGB}{100,130,150} +\definecolor{code-comment}{RGB}{20,120,80} +\definecolor{code-background}{gray}{0.99} +\lstset{ + language = [LaTeX]TeX, + basicstyle = \ttfamily, + keywordstyle = \color{code-main}, + commentstyle = \color{code-comment}, + showstringspaces = false, + breaklines = true, + frame = lines, + backgroundcolor = \color{code-background}, + flexiblecolumns = true, + escapeinside = {(*}{*)}, + alsoletter = {_,:}, + % numbers = left, + % firstnumber = last, + numberstyle = \scriptsize\ttfamily, + stepnumber = 1, + numbersep = 5pt, } -\providecommand{\meta}[1]{$\langle${\normalfont\itshape#1}$\rangle$} -\lstset{moretexcs=% - { +\newcommand{\meta}[1]{$\langle${\normalfont\itshape#1}$\rangle$} +\lstset{% LaTeX2 commands + classoffset = 0, + texcsstyle =* \color{code-main}, + moretexcs = + { cref,crefname, Cref,Crefname, crefformat, - crefthe,crefthename,crefthemark, + crefthe,crefthename, Crefthe,Crefthename, + crefthemark, selectlanguage, - } + } } -\lstnewenvironment{code}% -{\setstretch{1.07}\LocallyStopLineNumbers% -\setkeys{lst}{columns=fullflexible,keepspaces=true}% +\lstset{% LaTeX3 commands + classoffset = 1, + texcsstyle =* \color{code-expl3}, + moretexcs = + { + } } -{\ResumeLineNumbers\vspace{-.5\baselineskip}} -\lstnewenvironment{code*}% -{\setstretch{1.07}\LocallyStopLineNumbers% -\setkeys{lst}{numbers=left,columns=fullflexible,keepspaces=true}% -} -{\ResumeLineNumbers} +\lstnewenvironment{code}{\setstretch{1.05}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}} +\lstnewenvironment{code*}{\setstretch{1.05}\lstset{numbers=left}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}} + +\newcommand{\packageoption}[1]{\texttt{\textcolor{code-option}{#1}}} +\newcommand{\commandoption}[1]{\texttt{\textcolor{code-keys}{#1}}} %%================================ %% tip %%================================ \usepackage[many]{tcolorbox} -\newenvironment{tip}[1][Tip]{% +\newenvironment{tip}[1][Tip] + {% \LocallyStopLineNumbers% \begin{tcolorbox}[breakable, enhanced, @@ -69,32 +84,39 @@ top = 2.5mm, bottom = 1.5mm, title={\scshape\sffamily #1}]% -}{\end{tcolorbox}\ResumeLineNumbers} + } + {% + \end{tcolorbox}% + \ResumeLineNumbers% + } %%================================ %% demo %%================================ -\newenvironment{demo}{% +\newenvironment{demo} + {% \LocallyStopLineNumbers% \begin{tcolorbox}[enhanced jigsaw,pad at break*=1mm,breakable, left=2.5mm,right=3mm,top=0.5mm,bottom=0mm, colback=gray!5!paper,boxrule=0pt,frame hidden, borderline west={1.2mm}{0mm}{gray!55!paper},arc=.7mm]% -}{\end{tcolorbox}\ResumeLineNumbers} - - -\newcommand{\packageoption}[1]{\texttt{\textcolor{black!67!green}{#1}}} -\newcommand{\commandoption}[1]{\texttt{\textcolor{black!67!cyan}{#1}}} + } + {% + \end{tcolorbox}% + \ResumeLineNumbers% + } \newcommand{\crefthepackage}{\textsf{crefthe}} \begin{document} +\def\PackageVersion{2022/04/24} + \title{\crefthepackage{}\\\smallskip\itshape Cross referencing with proper definite articles} \author{Jinwen XU} -\thanks{Corresponding to: \texttt{\crefthepackage{} 2022/03/01}} -\date{March 2022, in Paris} +\thanks{Corresponding to: \texttt{\crefthepackage{} \PackageVersion}} +\date{\TheDate{\PackageVersion}[only-year-month], in Paris} \maketitle @@ -165,7 +187,7 @@ Before everything, you need to define the names, which can be done with \lstinli \end{tip} Then you can use the command \lstinline|\crefthe| as follows: -\begin{itemize} +\begin{itemize}[label=,leftmargin=1.25em,itemindent=-1.25em] \item \lstinline|\crefthe[|\meta{prep}\lstinline|]{|\meta{labels}\lstinline|}| \begin{itemize} \item This will pass the preposition \meta{prep} to the definite articles that follows. Its behavior depends on the current language (for example, in Spanish, \meta{prep} is passed only to the first definite article, while in French it is passed to everyone). diff --git a/macros/latex/contrib/crefthe/crefthe.sty b/macros/latex/contrib/crefthe/crefthe.sty index dd3ea31b1d..7c9a58965d 100644 --- a/macros/latex/contrib/crefthe/crefthe.sty +++ b/macros/latex/contrib/crefthe/crefthe.sty @@ -13,7 +13,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {crefthe} - {2022/03/01} {} + {2022/04/24} {} {Cross referencing with proper definite articles} \keys_define:nn { crefthe } @@ -57,7 +57,7 @@ } \cs_new_protected:Nn \__crefthe_cref_general:NNNnnN { - \tl_if_blank:eTF #4 + \tl_if_blank:eTF { #4 } { \bool_gset_false:N \g__crefthe_has_prep_bool } diff --git a/macros/latex/contrib/geradwp/LICENSE.txt b/macros/latex/contrib/geradwp/LICENSE.txt new file mode 100644 index 0000000000..2244313901 --- /dev/null +++ b/macros/latex/contrib/geradwp/LICENSE.txt @@ -0,0 +1,416 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2005 M. Y. Name + % + % 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. + % The latest version of this license is in + % http://www.latex-project.org/lppl.txt + % and version 1.3 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 M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. + diff --git a/macros/latex/contrib/geradwp/README.md b/macros/latex/contrib/geradwp/README.md index fa873fb414..783aa789b7 100644 --- a/macros/latex/contrib/geradwp/README.md +++ b/macros/latex/contrib/geradwp/README.md @@ -11,7 +11,7 @@ later version. ## VERSION -1.0 +1.1 ****************************************************************** _La version française de cette description est à la suite de la diff --git a/macros/latex/contrib/geradwp/geradwp-fr.pdf b/macros/latex/contrib/geradwp/geradwp-fr.pdf Binary files differindex c64aee442c..439eaadab0 100644 --- a/macros/latex/contrib/geradwp/geradwp-fr.pdf +++ b/macros/latex/contrib/geradwp/geradwp-fr.pdf diff --git a/macros/latex/contrib/geradwp/geradwp.dtx b/macros/latex/contrib/geradwp/geradwp.dtx index 1f5de065b7..cde22df387 100644 --- a/macros/latex/contrib/geradwp/geradwp.dtx +++ b/macros/latex/contrib/geradwp/geradwp.dtx @@ -1,6 +1,6 @@ % \iffalse % -% Copyright 2021 GERAD, HEC Montreal +% Copyright 2022 GERAD, HEC Montreal % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c @@ -25,7 +25,7 @@ \ProvidesFile{geradwp.dtx} %</dtx> %<class>\NeedsTeXFormat{LaTeX2e} -%<class>\ProvidesClass{geradwp}[2021/08/11 v1.0 Class for the Cahiers du GERAD series] +%<class>\ProvidesClass{geradwp}[2022/04/25 v1.1 Class for the Cahiers du GERAD series] %<*driver> \documentclass[10pt,oneside,french,english]{ltxdoc} \usepackage[utf8]{inputenc} @@ -63,6 +63,7 @@ \definecolor{shadecolor}{rgb}{0.93,0.97,0.99} \definecolor{TFFrameColor}{rgb}{0,0.235,0.443} \definecolor{TFTitleColor}{rgb}{1,1,1} +\definecolor{rouge}{RGB}{234,0,42} \hypersetup{ colorlinks=true, allcolors=liens, @@ -105,6 +106,12 @@ \href{#1}{\bfseries #2~\faExternalLink} } \newcommand{\oui}{\color{green}\faCheck} +\newenvironment{GDwarning}[1]{% + \begin{leftbar} + \noindent{\Large {\color{rouge}\faExclamationCircle} \textbf{#1}} \\ + }{% + \end{leftbar} +} \makeglossary @@ -113,7 +120,7 @@ \end{document} %</driver> % \fi -% \CheckSum{922} +% \CheckSum{1052} % \changes{1.0}{2021-08-11}{Initial release} % \ifnum\frenchdoc=1 % \title{Classe de documents \LaTeX\ pour la collection \cahiers} @@ -140,11 +147,12 @@ % le gabarit initialement distribu\'e par le GERAD. % \else % The \gdwp\ document class was designed to allow researchers who are -% \lien{https://www.gerad.ca/fr}{GERAD} members to write +% \lien{https://www.gerad.ca/en}{GERAD} members to write % their working papers, preprints and technical reports in line with the presentation % standards of \cahiers\ working paper series. This class and the % associated files replace the template that GERAD initially distributed. % \fi +% \changes{1.1}{2021-11-25}{Updated GERAD URLs in abstract.} % \end{abstract} % % \ifnum\frenchdoc=1 @@ -156,11 +164,12 @@ % % \subsection{Prerequisites} % \fi +% \label{subsec:prereq} % % \ifnum\frenchdoc=1 % L'utilisation de cette classe suppose que vous avez d\'ej\`a install\'e une distribution \TeX\ et -% un \'editeur de code int\'egr\'e. Pour la conception de \gdwp, la distribution -% \lien{https://www.tug.org/texlive/}{TeX Live 2020} et l'\'editeur de code +% un \'editeur de code int\'egr\'e. Pour la conception de \gdwp, les distributions +% \lien{https://www.tug.org/texlive/}{TeX Live 2020 et 2021} et l'\'editeur de code % \lien{https://www.texstudio.org/}{TeXstudio} ont \'et\'e utilis\'es. % % Si vous utilisez la distribution TeXLive ou \lien{http://www.tug.org/mactex/}{MacTeX} et que la compilation @@ -170,10 +179,18 @@ % \emph{packages} indiqu\'es dans le \autoref{tab:pre-loaded-pkgs} avant d'utiliser la classe \gdwp. % % Les utilisateurs d'\lien{https://www.overleaf.com/}{Overleaf} peuvent \'egalement utiliser cette classe -% en r\'ecup\'erant les fichiers sur le \lien{https://www.gerad.ca/fr/cahiers-procedure}{site du GERAD}. +% en r\'ecup\'erant les fichiers sur le \lien{https://www.gerad.ca/fr/publications/papers/cahiers-procedure}{site du GERAD}. +% \begin{GDwarning}{\gdwp\ utilise la version 4 de +fancyhdr+} +% \`A partir de la version 1.1 de \gdwp, la version 4 du \emph{package} +% \lien{https://www.ctan.org/pkg/fancyhdr}{fancyhdr} est utilis\'ee. Cette version introduit de nouvelles commandes qui +% ne sont pas compatibles avec la version 3. Elle est disponible sur les \'editions 2021 +% de Tex Live et MacTeX, de m\^eme que sur Overleaf si vous utilisez la version 2021 de TeX Live. +% +% Si vous utilisez une autre distribution \TeX, assurez-vous que vous avez la bonne version de +fancyhdr+. +% \end{GDwarning} % \else % Using this class assumes you’ve already installed a \TeX\ distribution with an integrated code editor. -% In designing \gdwp, the \lien{https://www.tug.org/texlive/}{TeX Live 2020} distribution and the +% In designing \gdwp, the \lien{https://www.tug.org/texlive/}{TeX Live 2020 and 2021} distributions and the % \lien{https://www.texstudio.org/}{TeXstudio} editor were used. % % If you are using TeXLive or \lien{http://www.tug.org/mactex/}{MacTeX} and your document compilation @@ -184,8 +201,20 @@ % versions of the packages % indicated in \autoref{tab:pre-loaded-pkgs} before using the \gdwp\ class. % -% Users of \lien{https://www.overleaf.com/}{Overleaf} can also use this class by downloading the necessary files from % the \lien{https://www.gerad.ca/fr/cahiers-procedure}{GERAD website}. +% Users of \lien{https://www.overleaf.com/}{Overleaf} can also use this class by downloading the necessary files from +% the \lien{https://www.gerad.ca/en/publications/papers/cahiers-procedure}{GERAD website}. +% \begin{GDwarning}{\gdwp\ makes use of +fancyhdr+ version 4} +% Starting at \gdwp\ version 1.1, version 4 of the \lien{https://www.ctan.org/pkg/fancyhdr}{fancyhdr} is +% used. This version introduces new commands that are not backwards compatible +% with version 3. It is available with the 2021 editions of +% Tex Live and MacTeX, as well as on Overleaf if you use the 2021 version of TeX Live. +% +% If you are using another \TeX\ distribution, please make sure that you have the right version of +% +fancyhdr+. +% \end{GDwarning} % \fi +% \changes{1.1}{2021-11-25}{Updated GERAD URLs in Prerequisites subsection.} +% \changes{1.1}{2021-12-07}{Added a warning concerning fancyhdr 4} % % \subsection{Installation} % @@ -284,6 +313,7 @@ % \fi % % \subsection{Options} +% \label{subsec:options} % \ifnum\frenchdoc=1 % Outre les options disponibles via la classe +article+, quelques options sont disponibles pour \gdwp. % \else @@ -367,15 +397,31 @@ % \fi % \end{DescribeMacro} % +% \begin{DescribeMacro}{gdsupplement} +% \ifnum\frenchdoc=1 +% Lorsqu'un auteur souhaite ajouter un suppl\'ement de recherche ou une «annexe» tr\`es importante \`a +% son cahier de recherche sans l'inclure dans le document principal, il peut ajouter cette partie dans un autre +% gabarit \gdwp\ vierge et y inclure l'option +gdsupplement+. Jumel\'ee avec la commande +\GDsupplementname+ +% (voir la \autoref{sec:metadonnees}), l'option affichera clairement le nom du suppl\'ement dans les pages titre +% et les ent\^etes du document suppl\'ementaire. +% \else +% When authors want to add extra research data or an important ``appendix'' to their working paper without +% including it in the main document, they can write that extra material in a blank \gdwp\ template with the +% +gdsupplement+ option included. Combined with the +\GDsupplementname+ command (see \autoref{sec:metadonnees}), this +% option will clearly show the supplement name on the title pages and page headers. +% \fi +% \end{DescribeMacro} +% % \begin{DescribeMacro}{gdminitabs} % \ifnum\frenchdoc=1 % Il arrive parfois que des auteurs cr\'eent des tableaux si grands que ceux-ci d\'epassent d'une -% ou plusieurs marges. Dans de tels cas, l'option +gdneedsminitabs+ est utilis\'ee pour mettre les +% ou plusieurs marges. Dans de tels cas, l'option +gdminitabs+ est utilis\'ee pour mettre les % tableaux du document en +footnotesize+. % \else % Authors sometimes create tables so large that they extend beyond the margins. To solve this issue, -% the +gdneedsminitabs+ option can be used to set the tables in the document to +footnotesize+. +% the +gdminitabs+ option can be used to set the tables in the document to +footnotesize+. % \fi +% \changes{1.1}{2021-12-06}{Corrected the gdminitabs typo} % \end{DescribeMacro} % % \ifnum\frenchdoc=1 @@ -395,6 +441,7 @@ % can choose to use whichever packages they will need, taking into account their features (see below). Care should % be taken not to reload any of them or to change any of the default options. % \fi +% \changes{1.1}{2022-01-28}{Changed color package for xcolor} % % \begin{table}[tbh] % \begin{tabularx}{\textwidth}{Xccl} @@ -417,10 +464,11 @@ % multirow & \oui & & \\ % array & \oui & & \\ % caption & \oui & & font=\{footnotesize,bf,sf\} \\ -% color & \oui & & \\ +% xcolor & \oui & & \\ % enumitem & \oui & & \\ % float & \oui & & \\ % algorithm & & \oui & \\ +% algorithmic & & \oui & \\ % algorithm2e & & \oui & \\ % hyperref & & \oui & colorlinks \\ % & & & citecolor=\{blue\} \\ @@ -438,46 +486,68 @@ % % \subsubsection{babel} % \ifnum\frenchdoc=1 -% L'auteur de ces lignes ayant \'et\'e inform\'e par la maintenanci\`ere du gabarit originel que l'utilisation de babel +% L'auteur de ces lignes ayant \'et\'e inform\'e par la maintenanci\`ere du gabarit originel que l'utilisation de +% babel % avec ce dernier causait de nombreux probl\`emes, il vous serait gr\'e de \textbf{ne pas utiliser le -% \emph{package} babel avec ce nouveau gabarit}, et ce, jusqu'\`a ce que lesdits probl\`emes lui soient pr\'esent\'es +% \emph{package} babel avec ce nouveau gabarit}, et ce, jusqu'\`a ce que lesdits probl\`emes lui soient +% pr\'esent\'es % afin d'\^etre corrig\'es. Une version ult\'erieure de la classe vous permettra peut-\^etre de vous en servir. % \else -% The person maintaining the original template advised the author of this document class that using babel with the template -% causes a number of problems, +% The person maintaining the original template advised the author of this document class that using babel with the +% template causes a number of problems, % so \textbf{please do not use the babel package with this new template}, until these issues have been fixed. % A future release of the class may allow you to use it. % \fi % -% \subsubsection{algorithm, algorithm2e} +% \subsubsection{algorithm, algorithmic, algorithm2e} % % \ifnum\frenchdoc=1 -% \lien{https://www.ctan.org/pkg/algorithms}{algorithm} et \lien{https://www.ctan.org/pkg/algorithm2e}{algorithm2e} sont -% deux \emph{packages} ayant leurs aficionados respectifs parmi les auteurs de \emph{Cahiers du GERAD}. Tous deux sont -% accept\'es et charg\'es dans le pr\'eambule du gabarit. Il suffit de mettre en commentaire celui des deux qui ne -% sera pas utilis\'e. +% \lien{https://www.ctan.org/pkg/algorithms}{algorithm, algorithmic} et +% \lien{https://www.ctan.org/pkg/algorithm2e}{algorithm2e} sont +% trois \emph{packages} ayant leurs aficionados respectifs parmi les auteurs de \emph{Cahiers du GERAD}. Tous trois +% sont +% accept\'es et charg\'es dans le pr\'eambule du gabarit. Il suffit de mettre en commentaire ceux des trois qui ne +% seront pas utilis\'es. \textbf{Notez que +algorithm+ et +algorithmic+ doivent toujours \^etre charg\'es ensemble}, +% l'un ne fonctionnant pas sans l'autre. +algorithm2e+, quant \`a lui, est autosuffisant. % -% Les deux \emph{packages} ne peuvent cependant pas \^etre charg\'es ensemble puisqu'ils entrent en conflit et cr\'eent -% des bogues. +% +algorithm+ et +algorithm2e+ ne peuvent pas \^etre charg\'es ensemble puisqu'ils entrent en conflit et +% cr\'eent des bogues. +% +% Finalement, lorsque vous utilisez le couple +algorithm+ et +algorithmic+, veuillez s'il vous pla\^it mettre les +% +\caption+ de vos algorithmes en +\footnotesize+. % \else -% \lien{https://www.ctan.org/pkg/algorithms}{algorithm} and \lien{https://www.ctan.org/pkg/algorithm2e}{algorithm2e} are -% two different packages, each of which has its fans among the \emph{Cahiers du GERAD} authors. Both are accepted and -% loaded in the preamble of the template. Simply comment out the one that will not be used. +% \lien{https://www.ctan.org/pkg/algorithms}{algorithm, algorithmic} and \lien{https://www.ctan.org/pkg/algorithm2e}{algorithm2e} are +% three different packages, each of which has its fans among the \emph{Cahiers du GERAD} authors. All are accepted +% and loaded in the preamble of the template. Simply comment out those that will not be used. +% \textbf{Bear in mind that +algorithm+ and +algorithmic+ must be loaded together} as they don't work +% independently. +algorithm2e+, on the other hand, il self-sufficient. +% +% +algorithm+ and +algorithm2e+ are mutually exclusive and cannot be both loaded at once without causing bugs. % -% The two packages are mutually exclusive and cannot both be loaded at once without causing bugs. +% Finally, when using the +algorithm+ and +algorithmic+ duo, please put your algorithms' +\caption+ in +% +\footnotesize+. % \fi +% \changes{1.1}{2021-12-07}{Included algorithmic package in documentation} +% \changes{1.1}{2021-12-07}{Added the caption footnotesize note} % % \subsubsection{float} % % \ifnum\frenchdoc=1 % Le \emph{package} +float+ est charg\'e avec la classe \textbf{uniquement lorsque l'option +gdminitabs+ est utilis\'ee}, et ce, -% afin de transformer les tableaux en +footnotesize+. Si vous avez besoin de ce \emph{package} et que vos tableaux +% afin de transformer les tableaux en +footnotesize+. Si vous avez besoin de ce \emph{package} même si vos tableaux % sont raisonnablement petits, chargez-le dans le pr\'eambule de votre document. +% +% Si vous utilisez le \emph{package} +algorithm+, +float+ est charg\'e par ce dernier. Il est donc inutile de le +% charger dans le pr\'ambule. % \else % The +float+ package is loaded with the class \textbf{only when the +gdminitabs+ option is enabled}. When loaded, it resizes -% the tables in +footnotesize+. If you need this package and the tables are reasonably small, you can load it in the preamble +% the tables in +footnotesize+. If you need this package even if your tables are reasonably small, you can load it in the preamble % of the document. +% +% If you are using the +algorithm+ package, please note that it loads +float+, so there is no need to load it in +% the preamble. % \fi +% \changes{1.1}{2021-12-07}{Added the fact that algorithm loads float package} % % \subsubsection{cleveref} % @@ -502,9 +572,11 @@ % Les quelques commandes publiques qui ont \'et\'e cr\'e\'ees pour cette classe ont deux fonctions : renseigner les % m\'etadonn\'ees du cahier de recherche et faire de la mise en page. % \else -% The handful of public commands that were created for this class have two purposes: formatting and filling in metadata +% The handful of public commands that were created for this class have two purposes: document layout and filling in metadata % for the working paper. % \fi +% \changes{1.1}{2021-12-07}{All public commands have been translated in English} +% % % \ifnum\frenchdoc=1 % \subsubsection{M\'etadonn\'ees} @@ -522,7 +594,7 @@ % data that will be found on the cover and title pages of the paper. % \fi % -% \begin{DescribeMacro}{\GDtitre} +% \begin{DescribeMacro}{\GDtitle} % \ifnum\frenchdoc=1 % Le titre du cahier de recherche. Celui-ci se retrouve \`a la fois sur la page couverture et la page titre. % \else @@ -530,7 +602,7 @@ % \fi % \end{DescribeMacro} % -% \begin{DescribeMacro}{\GDauteursCourts} +% \begin{DescribeMacro}{\GDauthorsShort} % \ifnum\frenchdoc=1 % La liste des auteurs du cahier sous la forme \emph{[Initiale du pr\'enom]. [Nom de famille]} % (ex. : B. Hamel, K. H\'ebert). Le contenu de cette commande se retrouve sur la page couverture, sous le titre. @@ -540,7 +612,7 @@ % \fi % \end{DescribeMacro} % -% \begin{DescribeMacro}{\GDauteursCopyright} +% \begin{DescribeMacro}{\GDauthorsCopyright} % \ifnum\frenchdoc=1 % La liste des noms de famille des auteurs \`a la mention des droits d'auteurs au bas de la page titre. % \else @@ -548,7 +620,7 @@ % \fi % \end{DescribeMacro} % -% \begin{DescribeMacro}{\GDmois} +% \begin{DescribeMacro}{\GDmonth} % \ifnum\frenchdoc=1 % Le mois de publication du cahier de recherche dans ses formes fran\c{c}aise et anglaise. Le mois en fran\c{c}ais % est inscrit entre les premi\`eres accolades, celui en anglais, entre les deuxi\`emes. @@ -558,7 +630,7 @@ % \fi % \end{DescribeMacro} % -% \begin{DescribeMacro}{\GDannee} +% \begin{DescribeMacro}{\GDyear} % \ifnum\frenchdoc=1 % L'ann\'ee de publication du cahier sous la forme \emph{AAAA}. % \else @@ -566,7 +638,7 @@ % \fi % \end{DescribeMacro} % -% \begin{DescribeMacro}{\GDnumero} +% \begin{DescribeMacro}{\GDnumber} % \ifnum\frenchdoc=1 % Le num\'ero du cahier de recherche. Ce num\'ero est assign\'e par l'\'equipe du GERAD. % \else @@ -584,6 +656,19 @@ % \fi % \end{DescribeMacro} % +% \begin{DescribeMacro}{\GDsupplementname} +% \ifnum\frenchdoc=1 +% Si vous r\'edigez un suppl\'ement de recherche ou une annexe \`a l'aide du gabarit \gdwp\ et que vous +% l'indiquez avec l'option +gdsupplement+ (voir \autoref{subsec:options}), la commande +% +\GDsupplementname+ servira \`a nommer ledit suppl\'ement et la classe imprimera ce nom dans les pages +% titre et les ent\^etes du document. +% \else +% If you write extra research data or an appendix using the \gdwp\ template and the +gdsupplement+ option +% (see \autoref{subsec:options}), the +\GDsupplementname+ command will serve as place holder for the +% supplement's name and the class will output it on the title pages and on page headers. +% \fi +% \end{DescribeMacro} +% % \begin{DescribeMacro}{\GDpostpubcitation} % \ifnum\frenchdoc=1 % Lorsque le contenu du cahier de recherche est publi\'e chez un \'editeur, l'\'equipe du GERAD @@ -604,22 +689,22 @@ % supprim\'ees par des auteurs, des commandes ont \'et\'e cr\'e\'ees. Celles-ci marquent en m\^eme temps % les subdivisions du document. % \else -% \subsubsection{Formatting} +% \subsubsection{Document Layout} % % To keep the template from getting cluttered and to keep authors from deleting critical formatting commands, % commands were created to mark each subdivision of the document. % \fi % -% \begin{DescribeMacro}{\GDpageCouverture} +% \begin{DescribeMacro}{\GDcoverpage} % \ifnum\frenchdoc=1 % Toute la page couverture d'un cahier de recherche est g\'en\'er\'ee \`a partir de cette commande. % Elle est entre autres mise en forme avec les m\'etadonn\'ees des commandes cit\'ees \`a la % \autoref{sec:metadonnees}. La page titre qui suit la page couverture est quant \`a elle g\'en\'er\'ee -% par l'environnement +GDpagetitre+ d\'ecrit \`a la \autoref{sec:environnements}. +% par l'environnement +GDtitlepage+ d\'ecrit \`a la \autoref{sec:environnements}. % \else % The entire cover page is generated with this command. It is largely formatted with the formatting % commands listed in \autoref{sec:metadonnees}. The title page that follows the cover is generated -% by the +GDpagetitre+ environment described in \autoref{sec:environnements}. +% by the +GDtitlepage+ environment described in \autoref{sec:environnements}. % \fi % \end{DescribeMacro} % @@ -668,7 +753,7 @@ % \subsubsection{Title page} % \fi % -% \begin{DescribeEnv}{GDpagetitre} +% \begin{DescribeEnv}{GDtitlepage} % \ifnum\frenchdoc=1 % Toute la page titre est g\'en\'er\'ee par le biais de cet environnement. Les auteurs n'ont qu'\`a inscrire % leurs informations personnelles dans les environnements +GDauthlist+, +GDaffillist+ et +GDemaillist+ d\'ecrits @@ -814,7 +899,7 @@ % \fi % % \ifnum\frenchdoc=1 -% \subsection{\emph{Packages} par d\'efaut du cahier (lignes 104-117)} +% \subsection{\emph{Packages} par d\'efaut du cahier (lignes 92-106)} % % Tous les \emph{packages} qui ne sont pas charg\'es par d\'efaut dans le fichier de classe (voir le % \autoref{tab:pre-loaded-pkgs}) sont charg\'es dans cette section. C'est dans cette section que vous pourrez @@ -822,7 +907,7 @@ % vous devrez charger les \emph{packages} qui ont tendance \`a ne pas fonctionner ad\'equatement s'ils sont % charg\'es apr\`es le \emph{package} +hyperref+. % \else -% \subsection{Default packages (lines 104-117)} +% \subsection{Default packages (lines 92-106)} % % All the packages that are not loaded by default in the class (see \autoref{tab:pre-loaded-pkgs}) % are loaded in this section. It’s in this section that the choice between the +algorithm+ and +algorithm2e+ @@ -831,7 +916,7 @@ % \fi % % \ifnum\frenchdoc=1 -% \subsection{Options par d\'efaut du cahier (lignes 118-132)} +% \subsection{Options par d\'efaut du cahier (lignes 107-136)} % % Si vous nommez le r\'epertoire dans lequel vous compilerez vos figures diff\'eremment que le nom que nous % lui avons donn\'e par d\'efaut ou si vous avez plus d'un r\'epertoire de figures, vous pourrez inscrire @@ -842,7 +927,7 @@ % % Dans tous les autres cas, veuillez ne pas modifier cette section. % \else -% \subsection{Default options (lines 118-132)} +% \subsection{Default options (lines 107-136)} % % If the name of your folder containing your paper’s figures is named differently than the default name, % or if there are multiple folders with figures in them, this is where you can enter that information. @@ -853,7 +938,7 @@ % \fi % % \ifnum\frenchdoc=1 -% \subsection{Commandes de l'auteur (lignes 133-141)} +% \subsection{Commandes de l'auteur (lignes 137-145)} % % Cette section vous appartient enti\`erement. Vous pouvez y charger les \emph{packages} n\'ecessaires \`a % votre r\'edaction de m\^eme que leurs options. @@ -861,7 +946,7 @@ % C'est \'egalement dans cette section que vous pouvez inscrire vos commandes, environnements et % th\'eor\`emes personnalis\'es. % \else -% \subsection{Author commands (lines 133-141)} +% \subsection{Author commands (lines 137-145)} % % This section belongs entirely to the author. This is where all the packages needed for the paper can be loaded, % as well as their options. @@ -870,26 +955,26 @@ % \fi % % \ifnum\frenchdoc=1 -% \subsection{Métadonn\'ees du cahier (lignes 143-155)} +% \subsection{Métadonn\'ees du cahier (lignes 147-183)} % -% Cette section, dont une partie est à la fin du pr\'eambule et l'autre dans l'environnement +GDpagetitre+, au +% Cette section, dont une partie est à la fin du pr\'eambule et l'autre dans l'environnement +GDtitlepage+, au % d\'ebut du document, est l'endroit o\`u vous devrez inscrire toutes les m\'etadonn\'ees bibliographiques % de votre cahier. % \else -% \subsection{Metadata (lines 143-155)} +% \subsection{Metadata (lines 147-183)} % -% This section is divided in two: the first is at the end of the preamble, and the second in the +GDpagetitre+ +% This section is divided in two: the first is at the end of the preamble, and the second in the +GDtitlepage+ % environment located at the beginning of the document. This is where all the bibliographical metadata for the % paper should be. % \fi % % \ifnum\frenchdoc=1 -% \subsection{R\'esum\'es, mots-cl\'es, remerciements, article (lignes 156 et suivantes)} +% \subsection{R\'esum\'es, mots-cl\'es, remerciements, article (lignes 185 et suivantes)} % % Ces deux derni\`eres sections sont, bien entendu, les endroits o\`u vous r\'edigerez votre cahier de % recherche... % \else -% \subsection{Abstracts, keywords, acknowledgements, article (starting at line 156)} +% \subsection{Abstracts, keywords, acknowledgements, article (starting at line 185)} % % These last two sections are, of course, where the body of the article will be. % \fi @@ -931,6 +1016,7 @@ % it configures some parts of the formatting. Once the variables have been created, default values % are set. % \fi +% \changes{1.1}{2021-12-03}{Added isSupplement boolean and default value} % % \begin{macrocode} %<*class> @@ -943,6 +1029,7 @@ \newboolean{GD@needsSmallHeadSep} \newboolean{GD@isFinalImpression} \newboolean{GD@isPostPublication} +\newboolean{GD@isSupplement} \newboolean{GD@isRevised} \newboolean{GD@needsminitabs} @@ -952,6 +1039,7 @@ \setboolean{GD@needsSmallHeadSep}{false} \setboolean{GD@isFinalImpression}{false} \setboolean{GD@isPostPublication}{false} +\setboolean{GD@isSupplement}{false} \setboolean{GD@isRevised}{false} \setboolean{GD@needsminitabs}{false} % \end{macrocode} @@ -967,6 +1055,7 @@ % The few class options are declared here. They essentially change some boolean values % and pass some options to the +article+ class. % \fi +% \changes{1.1}{2021-12-03}{Added new gdsupplement option} % % \begin{macrocode} @@ -998,6 +1087,9 @@ \DeclareOption{gdpostpub}{% \setboolean{GD@isPostPublication}{true} } +\DeclareOption{gdsupplement}{% + \setboolean{GD@isSupplement}{true} +} \DeclareOption{gdrevised}{% \setboolean{GD@isRevised}{true} } @@ -1055,14 +1147,13 @@ \RequirePackage{multirow} \RequirePackage{array} \RequirePackage[font={footnotesize,bf,sf}]{caption} -\RequirePackage{color} +\RequirePackage{xcolor} \RequirePackage{enumitem} \ifthenelse{\boolean{GD@needsminitabs}}{% \RequirePackage{float} }{} % Required Packages Setup % -\definecolor{gris}{rgb}{0.44,0.44,0.44} % color pkg setup \captionsetup[table]{skip=5pt} % caption pkg setup % \end{macrocode} % @@ -1077,6 +1168,7 @@ % We begin by defining the lengths of the document. These can change from % one version of the paper to another. % \fi +% \changes{1.1}{2021-12-02}{Added new cover page vspace length} % % \begin{macrocode} @@ -1086,6 +1178,7 @@ \newlength{\GD@affilitemsep} \newlength{\GD@affiltopsep} \newlength{\GD@titleminipage@hspace} +\newlength{\GD@coverpage@vspace} \ifthenelse{\boolean{GD@isPlainVersion}}{% \setlength{\GD@authitemsep}{0pt} \setlength{\GD@authtopsep}{12pt} @@ -1111,7 +1204,7 @@ % \else % We then set up the geometry of the document, which varies from one version to another. % \fi -% +% \changes{1.1}{2022-01-18}{Removed nofoot option from plain geometry}% % \begin{macrocode} % Geometry % @@ -1129,7 +1222,6 @@ bmargin=2cm,% lmargin=3cm,% rmargin=3cm,% - nofoot,% headsep=30pt,% includehead} }{} @@ -1274,21 +1366,26 @@ % commands and populate different parts of the paper such as the headers, % cover page and title page. % \fi +% \changes{1.1}{2021-12-03}{Added internal supplement name command} +% \changes{1.1}{2021-12-07}{Translated all commands to english} % % \begin{macrocode} % Class Private Commands % % Metadata % -\newcommand{\gd@annee}{} -\newcommand{\gd@mois}{} -\newcommand{\gd@month}{} -\newcommand{\gd@numero}{} -\newcommand{\gd@titre}{} -\newcommand{\gd@auteurs@short}{} -\newcommand{\gd@auteurs@copyright}{} +\newcommand{\gd@year}{} +\newcommand{\gd@month@fr}{} +\newcommand{\gd@month@en}{} +\newcommand{\gd@number}{} +\newcommand{\gd@title}{} +\newcommand{\gd@authors@short}{} +\newcommand{\gd@authors@copyright}{} \newcommand{\gd@postpubcitation}{} \newcommand{\gd@postpubcitation@url}{} -\newcommand{\gd@revised}{} +\newcommand{\gd@supplementname}{} +\newcommand{\gd@revised@year}{} +\newcommand{\gd@revised@month@fr}{} +\newcommand{\gd@revised@month@en}{} % \end{macrocode} % % \ifnum\frenchdoc=1 @@ -1317,6 +1414,11 @@ % The following commands define its appearance. The bottom part of the page % is different if the +gdpostpub+ option is used. % \fi +% \changes{1.1}{2021-12-02}{Added new vspace length for paper version only} +% \changes{1.1}{2021-12-02}{Added vfill for web version only} +% \changes{1.1}{2012-12-03}{Added supplement name to web version cover page} +% \changes{1.1}{2021-12-03}{Added supplement name in paper cover page minipage} +% \changes{1.1}{2021-12-13}{Fixed GDcover@bottom@postpub} % % \begin{macrocode} @@ -1338,13 +1440,18 @@ \ifthenelse{\boolean{GD@isWebVersion}}{% \vspace*{54pt} - {\noindent\LARGE\bfseries \gd@titre\par} %Title - + {\noindent\LARGE\bfseries \gd@title\par} %Title + \ifthenelse{\boolean{GD@isSupplement}}% + {{\noindent\LARGE\gd@supplementname\par}}{} \vspace*{18pt} - {\noindent\Large\gd@auteurs@short\par} + {\noindent\Large\gd@authors@short\par} + + \vfill }{} - \vfill + \ifthenelse{\boolean{GD@isPaperVersion}}{% + \vspace*{\GD@coverpage@vspace} + }{} \hspace*{\GD@titleminipage@hspace} \begin{minipage}[c][5.4cm][c]{7cm} {\ifthenelse{\boolean{GD@isWebVersion}}% @@ -1366,14 +1473,14 @@ % Cover page minipage table (web version) \newcommand{\GDcover@minipagetable@web}{% \begin{tabular}{p{.5cm}|p{5.5cm}} - & \normalsize G--\gd@annee--\gd@numero + & \normalsize G--\gd@year--\gd@number \ifthenelse{\boolean{GD@needsminitabs}}% {\\*[10pt]}% {\\*[8pt]} - & \normalsize\gd@month\ \gd@annee + & \normalsize\gd@month@en\ \gd@year \ifthenelse{\boolean{GD@isRevised}}{% \\ - &\normalsize Revised: \gd@revised + &\normalsize Revised: \gd@revised@month@en\ \gd@revised@year }{} \end{tabular} } @@ -1381,22 +1488,24 @@ % Cover page minipage table (paper version) \newcommand{\GDcover@minipagetable@paper}{% \begin{tabular}{p{.5cm}|p{5.5cm}} - \multicolumn{2}{p{6.5cm}}{\normalsize\bfseries \gd@titre + \multicolumn{2}{p{6.5cm}}{\normalsize\bfseries \gd@title \ifthenelse{\boolean{GD@needsminitabs}}% {\vspace*{12.5pt}}% {\vspace*{10pt}}}\\ - & \normalsize\gd@auteurs@short \\ %Initials. Name + \ifthenelse{\boolean{GD@isSupplement}}% + {& \gd@supplementname\\*[10pt]}{} + & \normalsize\gd@authors@short \\ %Initials. Name & \ifthenelse{\boolean{GD@needsminitabs}}% {\\*[15pt]}% {\\*[12pt]} - & \normalsize G--\gd@annee--\gd@numero + & \normalsize G--\gd@year--\gd@number \ifthenelse{\boolean{GD@needsminitabs}}% {\\*[10pt]}% {\\*[8pt]} - & \normalsize\gd@month\ \gd@annee + & \normalsize\gd@month@en\ \gd@year \ifthenelse{\boolean{GD@isRevised}}{% \\ - &\normalsize Revised: \gd@revised + &\normalsize Revised: \gd@revised@month@en\ \gd@revised@year }{} \end{tabular} } @@ -1417,12 +1526,16 @@ \medskip \scriptsize - \textbf{Citation sugg\'{e}r\'{e}e :} \gd@auteurs@short~(\gd@mois\ - \gd@annee). \gd@titre, Rapport technique, Les Cahiers du GERAD G-- - \gd@annee--\gd@numero, GERAD, HEC Montr\'{e}al, Canada.\\ + \textbf{Citation sugg\'{e}r\'{e}e :} \gd@authors@short~(\gd@month@fr\ + \gd@year). \gd@title, + \ifthenelse{\boolean{GD@isSupplement}}{\gd@supplementname .}{} + Rapport technique, Les Cahiers du GERAD G-- + \gd@year--\gd@number, GERAD, HEC Montr\'{e}al, Canada. + \ifthenelse{\boolean{GD@isRevised}}% + { Version r\'evis\'ee: \gd@revised@month@fr\ \gd@revised@year}{}\\ \textbf{Avant de citer ce rapport technique,} veuillez visiter notre - site Web (\url{https://www.gerad.ca/fr/papers/G-\gd@annee-\gd@numero}) + site Web (\url{https://www.gerad.ca/fr/papers/G-\gd@year-\gd@number}) afin de mettre \`a jour vos donn\'ees de r\'ef\'erence, s'il a \'et\'e publi\'e dans une revue scientifique.\par \end{minipage} @@ -1436,12 +1549,16 @@ added.\\ \\ \scriptsize - \textbf{Suggested citation:} \gd@auteurs@short~(\gd@month\ \gd@annee). - \gd@titre, Technical report, Les Cahiers du GERAD G--\gd@annee--\gd@numero, - GERAD, HEC Montr\'{e}al, Canada.\\ + \textbf{Suggested citation:} \gd@authors@short~(\gd@month@en\ \gd@year). + \gd@title, + \ifthenelse{\boolean{GD@isSupplement}}{\gd@supplementname .}{} + Technical report, Les Cahiers du GERAD G--\gd@year--\gd@number, + GERAD, HEC Montr\'{e}al, Canada. + \ifthenelse{\boolean{GD@isRevised}}% + { Revised version: \gd@revised@month@en\ \gd@revised@year}{}\\ \textbf{Before citing this technical report,} please visit our website - (\url{https://www.gerad.ca/en/papers/G-\gd@annee-\gd@numero}) to update + (\url{https://www.gerad.ca/en/papers/G-\gd@year-\gd@number}) to update your reference data, if it has been published in a scientific journal. \par \end{minipage} @@ -1459,8 +1576,8 @@ \medskip D\'ep\^ot l\'egal -- Biblioth\`eque et Archives nationales du Qu\'ebec, - \gd@annee\\ - \phantom{Depot legal} -- Biblioth\`eque et Archives Canada, \gd@annee + \gd@year\\ + \phantom{Depot legal} -- Biblioth\`eque et Archives Canada, \gd@year \par \end{minipage} \hfill @@ -1473,8 +1590,8 @@ \medskip Legal deposit -- Biblioth\`eque et Archives nationales du Qu\'ebec, - \gd@annee\\ - \phantom{Legal deposit} -- Library and Archives Canada, \gd@annee\par + \gd@year\\ + \phantom{Legal deposit} -- Library and Archives Canada, \gd@year\par \end{minipage} \hrule @@ -1546,10 +1663,8 @@ \hrule \smallskip - \noindent - \begin{minipage}[t][2.1cm][l]{7.5cm} + \noindent\begin{minipage}[t][2.1cm][l]{7.5cm} \scriptsize - \medskip La publication de ces rapports de recherche est rendue possible gr\^ace au soutien de HEC Montr\'eal, Polytechnique Montr\'eal, Universit\'e McGill, Universit\'e du Qu\'ebec \`a Montr\'eal, ainsi que du Fonds de @@ -1557,13 +1672,13 @@ \medskip D\'ep\^ot l\'egal -- Biblioth\`eque et Archives nationales du Qu\'ebec, - 2020\\ - \phantom{Depot legal} -- Biblioth\`eque et Archives Canada, 2020\par + \gd@year\\ + \phantom{Depot legal} -- Biblioth\`eque et Archives Canada, \gd@year + \par \end{minipage} \hfill \begin{minipage}[t][2.1cm][l]{7.5cm} \scriptsize - \medskip The publication of these research reports is made possible thanks to the support of HEC Montr\'eal, Polytechnique Montr\'eal, McGill University, Universit\'e du Qu\'ebec \`a Montr\'eal, as well as @@ -1571,8 +1686,8 @@ \medskip Legal deposit -- Biblioth\`eque et Archives nationales du Qu\'ebec, - 2020\\ - \phantom{Legal deposit} -- Library and Archives Canada, 2020\par + \gd@year\\ + \phantom{Legal deposit} -- Library and Archives Canada, \gd@year\par \end{minipage} \hrule @@ -1609,14 +1724,17 @@ % \ifnum\frenchdoc=1 % La page titre s'affiche dans toutes les versions du cahier, mais % diffère en fonction des versions. Étant donné qu'elle est contenue -% dans l'environnement +GDpagetitre+, les commandes internes pour son +% dans l'environnement +GDtitlepage+, les commandes internes pour son % affichage sont divisées en deux parties +@begin+ et +@end+. % \else % The title page appears in all versions of the paper, but it varies -% according to the version. Given that it is contained in the +GDpagetitre+ +% according to the version. Given that it is contained in the +GDtitlepage+ % environment, the internal commands for the title page’s display are % divided into two parts: +@begin+ and +@end+. % \fi +% \changes{1.1}{2021-12-03}{Added supplement name to title page} +% \changes{1.1}{2021-12-06}{Added the Revised prefix} +% \changes{1.1}{2021-12-06}{Changed plain title page's month for english} % % \begin{macrocode} @@ -1631,7 +1749,10 @@ } \parindent=0pt \sffamily - {\LARGE\bfseries \gd@titre\par} %Title + {\LARGE\bfseries \gd@title\par} %Title + \ifthenelse{\boolean{GD@isSupplement}}% + {{\LARGE\gd@supplementname\par} + }{} \begin{minipage}[t][10cm][l]{7.5cm} \vspace*{55pt} } @@ -1640,14 +1761,14 @@ \vfill \end{minipage} \vfill -{\bfseries \gd@month\ \gd@annee}\\* +{\bfseries \gd@month@en\ \gd@year}\\* \ifthenelse{\boolean{GD@isRevised}}% - {\\ \gd@revised \\}% + {Revised: \gd@revised@month@en\ \gd@revised@year \\}% {} {\bfseries Les Cahiers du GERAD}\\ -{\bfseries G--\gd@annee--\gd@numero}\\ -{\footnotesize Copyright \copyright\ \gd@annee\ GERAD, - \gd@auteurs@copyright} +{\bfseries G--\gd@year--\gd@number}\\ +{\footnotesize Copyright \copyright\ \gd@year\ GERAD, + \gd@authors@copyright} \vspace*{0.05cm} \hrule @@ -1705,12 +1826,16 @@ \newcommand{\GD@plain@titlepage@begin}{% \thispagestyle{empty} \sffamily - {\sffamily\LARGE\bfseries\noindent\gd@titre\par} + {\sffamily\LARGE\bfseries\noindent\gd@title\par} + \ifthenelse{\boolean{GD@isSupplement}}% + {{\noindent\LARGE\gd@supplementname\par}}{} } \newcommand{\GD@plain@pagetitle@end}{% \vspace*{12pt} - {\noindent\gd@mois\ \gd@annee} + {\noindent\gd@month@en\ \gd@year} + \ifthenelse{\boolean{GD@isRevised}}% + {\\ {\noindent Revised: \gd@revised@month@en\ \gd@revised@year}}{} \vspace*{30pt} } % \end{macrocode} @@ -1729,6 +1854,32 @@ % cannot be reused or moved. % \fi % +% +% \ifnum\frenchdoc=1 +% \subsubsection{Mise en forme du document} +% La quantit\'e de versions possibles d'un gabarit \gdwp\ impose que certaines +% commandes internes de mise en forme puissent \^etre modifi\'ees simplement par +% le biais de commandes publiques, disponibles dans le pr\'eambule. Cela facilite +% le travail des responsables de l'\'edition et emp\^eche la multiplication de +% versions maison de la classe\footnote{Toute r\'ef\'erence \`a une personne r\'eelle est % +% totalement fortuite.}. +% \else +% \subsubsection{Document layout} +% The number of a \gdwp\ template's possible versions imply that some internal document +% layout commands must be easily changed via public commands, available in the template's +% preamble. This allows more efficient work on the publisher's side and prevents the +% multiplication of homemade versions of the class\footnote{Any reference to a real-life person % +% is pure coincidence.}. +% \fi +% \changes{1.1}{2021-12-02}{Added new GDcoverpagewhitespace command to change cover page vspace} +% +% \begin{macrocode} + +% Layout public commands +\newcommand{\GDcoverpagewhitespace}[1]{% + \setlength{\GD@coverpage@vspace}{#1} +} +% \end{macrocode} % \ifnum\frenchdoc=1 % \subsubsection{M\'etadonn\'ees} % Les commandes suivantes sont celles o\`u l'utilisateur saisit les donn\'ees @@ -1740,35 +1891,41 @@ % bibliographical data. They modify the values of the corresponding private % commands (see \autoref{ann:private-meta}). % \fi +% \changes{1.1}{2021-12-03}{Added public GDsupplementname command} % % \begin{macrocode} % Metadata public commands -\newcommand{\GDannee}[1]{% - \renewcommand{\gd@annee}{#1} +\newcommand{\GDyear}[1]{% + \renewcommand{\gd@year}{#1} } -\newcommand{\GDmois}[2]{% - \renewcommand{\gd@mois}{#1} - \renewcommand{\gd@month}{#2} +\newcommand{\GDmonth}[2]{% + \renewcommand{\gd@month@fr}{#1} + \renewcommand{\gd@month@en}{#2} } -\newcommand{\GDnumero}[1]{% - \renewcommand{\gd@numero}{#1} +\newcommand{\GDnumber}[1]{% + \renewcommand{\gd@number}{#1} } -\newcommand{\GDtitre}[1]{% - \renewcommand{\gd@titre}{#1} +\newcommand{\GDtitle}[1]{% + \renewcommand{\gd@title}{#1} } -\newcommand{\GDauteursCourts}[1]{% - \renewcommand{\gd@auteurs@short}{#1} +\newcommand{\GDauthorsShort}[1]{% + \renewcommand{\gd@authors@short}{#1} } -\newcommand{\GDauteursCopyright}[1]{% - \renewcommand{\gd@auteurs@copyright}{#1} +\newcommand{\GDauthorsCopyright}[1]{% + \renewcommand{\gd@authors@copyright}{#1} } \newcommand{\GDpostpubcitation}[2]{% \renewcommand{\gd@postpubcitation}{#1} \renewcommand{\gd@postpubcitation@url}{#2} } -\newcommand{\GDrevised}[1]{% - \renewcommand{\gd@revised}{#1} +\newcommand{\GDsupplementname}[1]{% + \renewcommand{\gd@supplementname}{#1} +} +\newcommand{\GDrevised}[3]{% + \renewcommand{\gd@revised@month@fr}{#1} + \renewcommand{\gd@revised@month@en}{#2} + \renewcommand{\gd@revised@year}{#3} } % \end{macrocode} % @@ -1787,16 +1944,18 @@ % multiple lines of code, a few commands and environments were created to group them % together. % \fi +% \changes{1.1}{2021-12-03}{Added supplement name in header} +% \changes{1.1}{2021-12-03}{Replaced all fancyhdr v3 commands by v4 commands} % % \begin{macrocode} % Cover page -\newcommand{\GDpageCouverture}{% +\newcommand{\GDcoverpage}{% \ifthenelse{\boolean{GD@isPlainVersion}}{}{\GD@cover} } % Title page -\newenvironment{GDpagetitre}{ +\newenvironment{GDtitlepage}{ \ifthenelse{\boolean{GD@isPlainVersion}}% {\GD@plain@titlepage@begin}% {\GD@titlepage@begin} @@ -1841,29 +2000,33 @@ \setcounter{page}{2} \renewcommand{\thepage}{\roman{page}} \pagestyle{fancy} - \lhead[ - \textcolor{gris}{\sffamily{\,}\thepage}\hfill - \textcolor{gris}{\sffamily G--\gd@annee--\gd@numero}\hfill % - \ifthenelse{\boolean{GD@isRevised}}% - {{ -- \itshape Revised}}% - {} - \textcolor{gris}{\sffamily Les Cahiers du GERAD} - {\large\strut}\color{gris}{\hrule} - ] - { - \textcolor{gris}{\sffamily{\,} Les Cahiers du GERAD}\hfill - \textcolor{gris}{\sffamily G--\gd@annee--\gd@numero}\hfill % + \fancyhead[LO]{% + \textcolor{gray}{\sffamily{\,} Les Cahiers du GERAD}\hfill + \textcolor{gray}{\sffamily G--\gd@year--\gd@number}% + \ifthenelse{\boolean{GD@isSupplement}}% + {\textcolor{gray}{\sffamily\ -- \itshape \gd@supplementname}}% + {} % \ifthenelse{\boolean{GD@isRevised}}% - {{ -- \itshape Revised}}% - {} - \textcolor{gris}{\sffamily\thepage} - {\large\strut}\color{gris}{\hrule} + {\textcolor{gray}{\sffamily\ -- \itshape Revised}}% + {}\hfill + \textcolor{gray}{\sffamily\thepage} + {\large\strut}\color{gray}{\hrule} } - \chead[]{} - \rhead[]{} - \lfoot[]{} - \cfoot[]{} - \rfoot[]{} + \fancyhead[LE]{% + \textcolor{gray}{\sffamily{\,}\thepage}\hfill + \textcolor{gray}{\sffamily G--\gd@year--\gd@number}% + \ifthenelse{\boolean{GD@isSupplement}}% + {\textcolor{gray}{\sffamily\ -- \itshape \gd@supplementname}}% + {} % + \ifthenelse{\boolean{GD@isRevised}}% + {\textcolor{gray}{\sffamily\ -- \itshape Revised}}% + {}\hfill + \textcolor{gray}{\sffamily Les Cahiers du GERAD} + {\large\strut}\color{gray}{\hrule} + } + \fancyhead[C]{} + \fancyhead[R]{} + \fancyfoot{} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \rmfamily @@ -1900,6 +2063,51 @@ \rmfamily } } +% \end{macrocode} +% +% \ifnum\frenchdoc=1 +% \subsection{Commandes et environnements obsol\`etes} +% Dans la version 1.1 de \gdwp, toutes les commandes et environnements qui avaient un nom +% fran\c{c}ais ont \'et\'e traduits en anglais dans un souci d'uniformit\'e +% et pour faciliter la compr\'ehension des noms par le plus grand nombre +% d'utilisateurs. +% +% Les commandes et environnements fran\c{c}ais sont maintenus, mais seulement pour permettre +% la r\'etrocompatibilit\'e du gabarit de la version 1.0 avec la d\'efinition +% de classe des versions subs\'equentes. Une fois que cette version du gabarit +% ne sera plus en circulation, tout ce qui est obsol\`ete sera retir\'e +% de la classe. +% \else +% \subsection{Deprecated commands and environments} +% In \gdwp\ version 1.1, all commands and environments that had French names have been translated +% in English for consistency reasons and to make sure that the they could +% be directly understood by most users. +% +% The French commands and environments are preserved only to ensure backwards compatibility +% between version 1.0 of the template and subsequent versions of the class. +% Once that version of the template stops circulating, everything that is deprecated will be +% removed from the class. +% \fi +% +% \begin{macrocode} + +\newcommand{\GDtitre}[1]{\GDtitle{#1}} +\newcommand{\GDmois}[2]{\GDmonth{#1}{#2}} +\newcommand{\GDannee}[1]{\GDyear{#1}} +\newcommand{\GDnumero}[1]{\GDnumber{#1}} +\newcommand{\GDauteursCourts}[1]{\GDauthorsShort{#1}} +\newcommand{\GDauteursCopyright}[1]{\GDauthorsCopyright{#1}} +\newcommand{\GDpageCouverture}{\GDcoverpage} +\newenvironment{GDpagetitre}{ + \ifthenelse{\boolean{GD@isPlainVersion}}% + {\GD@plain@titlepage@begin}% + {\GD@titlepage@begin} +}{ + \ifthenelse{\boolean{GD@isPlainVersion}}% + {\GD@plain@pagetitle@end}% + {\GD@titlepage@end} +} + %</class> % \end{macrocode} % @@ -1909,6 +2117,8 @@ % \iffalse % ^^A Code du gabarit %<*template> +%% Template version 1.1 +%% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %%%%%%%%%% Notes pour les auteurs %%%%%%%%%%%%%%% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1983,8 +2193,12 @@ \PassOptionsToPackage{hyphens}{url} %% Choose one of the two following algorithm packages -%% \usepackage{algorithm} -\usepackage{algorithm2e} +%% \usepackage[ruled]{algorithm} +%% \usepackage{algorithmic} +% \changes{1.1}{2021-12-07}{Added package algorithmic in preamble} +\usepackage[ruled,linesnumbered]{algorithm2e} +% \changes{1.1}{2021-12-06}{Added options to algorithm packages} +\usepackage[french]{babel} \usepackage{hyperref} %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1994,6 +2208,8 @@ %% %%% ----- DO NOT MODIFY! -------- %%%%%%%%%%%%%%% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\GDcoverpagewhitespace{6.8cm} +% \changes{1.1}{2021-12-02}{Added new white space command for paper version} \graphicspath{{Figures/}} % graphicx pkg setup \hypersetup{colorlinks,% citecolor={blue}, % Change for "black" with natbib @@ -2002,6 +2218,21 @@ breaklinks={true} } +%% Algorithm caption customizations +\makeatletter +\ifthenelse{\isundefined{\ALG@name}}{}% +{% + \renewcommand{\ALG@name}{\sffamily\footnotesize Algorithm} +} +\makeatother +%% Algorithm2e caption customizations +\ifthenelse{\isundefined{\SetAlCapNameFnt}}{}% +{% + \SetAlCapNameFnt{\footnotesize} + \SetAlCapFnt{\sffamily\footnotesize} +} +% \changes{1.1}{2021-12-07}{Added algorithm caption customizations} + %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %%%%%% Début - commandes de l'auteur %%%%%%%%%%%% %% %%%%%%%% Start of author commands %%%%%%%%%%%%%%% @@ -2016,20 +2247,23 @@ %% %%%%%%%%%% Métadonnées du cahier %%%%%%%%%%%%%%% %% %%%%%%%%%% Working paper metadata %%%%%%%%%%%%%%% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\GDtitre{This is a title} -\GDmois{Mai}{May} -\GDannee{2021} -\GDnumero{XX} -\GDauteursCourts{B. Hamel, K. H\'ebert} -\GDauteursCopyright{Hamel, H\'ebert} -\GDpostpubcitation{Hamel, Benoit, Karine H\'ebert (2021). \og Un exemple de citation \fg, \emph{Journal of Journals}, vol. X issue Y, p. n-m}{https://www.gerad.ca/fr} -\GDrevised{Mai 2021} +\GDtitle{This is a title} +\GDmonth{Mai}{May} +\GDyear{2021} +\GDnumber{XX} +\GDauthorsShort{B. Hamel, K. H\'ebert} +\GDauthorsCopyright{Hamel, H\'ebert} +\GDpostpubcitation{Hamel, Benoit, Karine H\'ebert (2021). ``Un exemple de citation'', \emph{Journal of Journals}, vol. X issue Y, p. n-m}{https://www.gerad.ca/fr} +\GDsupplementname{Internet Appendix} +% \changes{1.1}{2021-12-03}{Added GDsupplementname to template preamble} +\GDrevised{Mai}{May}{2021} +% \changes{1.1}{2021-12-15}{Replaced original GDrevised by its bilingual version} \begin{document} - \GDpageCouverture + \GDcoverpage - \begin{GDpagetitre} + \begin{GDtitlepage} \begin{GDauthlist} \GDauthitem{Benoit Hamel \ref{affil:bib}} @@ -2047,7 +2281,7 @@ \GDemailitem{karine.hebert@gerad.ca} \end{GDemaillist} - \end{GDpagetitre} + \end{GDtitlepage} %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %%%%%%%%% Résumés, mots-clés, remerciements %%%%%%%%%%% diff --git a/macros/latex/contrib/geradwp/geradwp.ins b/macros/latex/contrib/geradwp/geradwp.ins index 7ef7e7c993..fa55d12649 100644 --- a/macros/latex/contrib/geradwp/geradwp.ins +++ b/macros/latex/contrib/geradwp/geradwp.ins @@ -1,5 +1,5 @@ %% -%% Copyright 2021 GERAD, HEC Montréal +%% Copyright 2022 GERAD, HEC Montréal %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c @@ -19,7 +19,7 @@ This is a stripped version of the original file. -Copyright 2021 GERAD, HEC Montreal +Copyright 2022 GERAD, HEC Montreal This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c @@ -47,16 +47,15 @@ geradwp.pdf and the derived files listed in the README file. \obeyspaces \Msg{*********************************************************} -\Msg{* Classe geradwp v1.0 *} +\Msg{* Classe geradwp v1.1 *} \Msg{* *} -\Msg{* La classe geradwp est installee et prete a l'emploi. *} -\Msg{* Consultez le document geradwp.pdf afin de prendre *} -\Msg{* connaissance de toutes ses fonctionnalites. *} +\Msg{* The geradwp document class is installed and ready to *} +\Msg{* to be used. Please read the documentation in order to *} +\Msg{* understand all its features. *} \Msg{* *} -\Msg{* Pour tout commentaire, demande de correction de bogue *} -\Msg{* ou d'amelioration, ou tout simplement pour obtenir de *} -\Msg{* l'aide sur l'utilisation de la classe pour votre *} -\Msg{* travail, communiquez avec Benoit Hamel a l'adresse *} +\Msg{* If you have any comments, bug fix or feature request, *} +\Msg{* or if you need any assistance on how to use the class *} +\Msg{* and its template, please contact Benoit Hamel at *} \Msg{* benoit.2.hamel[a]hec.ca. *} \Msg{*********************************************************} diff --git a/macros/latex/contrib/geradwp/geradwp.pdf b/macros/latex/contrib/geradwp/geradwp.pdf Binary files differindex 3b22f85463..d3dcd248f3 100644 --- a/macros/latex/contrib/geradwp/geradwp.pdf +++ b/macros/latex/contrib/geradwp/geradwp.pdf diff --git a/macros/latex/contrib/hvlogos/Changes b/macros/latex/contrib/hvlogos/Changes index f206cbb406..9517b17c84 100644 --- a/macros/latex/contrib/hvlogos/Changes +++ b/macros/latex/contrib/hvlogos/Changes @@ -1,8 +1,9 @@ hvlogos.sty: +0.08 2022-04-25 - added \mkII, \mkIV 0.07 2022-02-28 - fix for \dante and \eV 0.06 2022-01-23 - added \BibLaTeXML 0.05 2022-01-08 - added \LuaMetaTeX and \LMTX with alias in lowercase letters -0.04 2021-10-02 - added new macros to user-defined kernings +0.04 2021-10-02 - added \tex4ht 0.03 2021-09-25 - \tikz in regular font - \CTAN is sf font 0.02 2021-08-13 - fix for \tikz which is reserved by package tikz diff --git a/macros/latex/contrib/hvlogos/README b/macros/latex/contrib/hvlogos/README index 540ae523e8..5533d66103 100644 --- a/macros/latex/contrib/hvlogos/README +++ b/macros/latex/contrib/hvlogos/README @@ -1,5 +1,5 @@ -hvlogos +hvlogos Printing TeX related names as a logo %% This program can be redistributed and/or modified under the terms diff --git a/macros/latex/contrib/hvlogos/doc/hvlogos-doc.pdf b/macros/latex/contrib/hvlogos/doc/hvlogos-doc.pdf Binary files differindex ffcc2d1d71..8b483f54d1 100644 --- a/macros/latex/contrib/hvlogos/doc/hvlogos-doc.pdf +++ b/macros/latex/contrib/hvlogos/doc/hvlogos-doc.pdf diff --git a/macros/latex/contrib/hvlogos/doc/hvlogos-doc.tex b/macros/latex/contrib/hvlogos/doc/hvlogos-doc.tex index aef5ba2655..30ffb01ad5 100644 --- a/macros/latex/contrib/hvlogos/doc/hvlogos-doc.tex +++ b/macros/latex/contrib/hvlogos/doc/hvlogos-doc.tex @@ -87,6 +87,8 @@ The package \LPack{hvlogos} loads by default the packages \Lcs{METAFONT} & \Lcs{MF}& \METAFONT \\ \Lcs{MetaFun} &\Lcs{MFun} & \MetaFun\\ \Lcs{METAPOST} & \Lcs{MetaPost}, \Lcs{MP}& \METAPOST \\ +\Lcs{mkII} &\Lcs{mkii}& \mkII \\ +\Lcs{mkIV} &\Lcs{mkiv}& \mkIV \\ \Lcs{MiKTeX} && \MiKTeX \\[5pt] \Lcs{NTS} && \NTS \\[5pt] diff --git a/macros/latex/contrib/hvlogos/latex/hvlogos.sty b/macros/latex/contrib/hvlogos/latex/hvlogos.sty index 78f8bf3ee0..5a94c04554 100644 --- a/macros/latex/contrib/hvlogos/latex/hvlogos.sty +++ b/macros/latex/contrib/hvlogos/latex/hvlogos.sty @@ -10,7 +10,7 @@ % % % ------------------------------------- -\ProvidesPackage{hvlogos}[2022/02/28 v. 0.07 Logos (hv)] +\ProvidesPackage{hvlogos}[2022/04/25 v. 0.08 Logos (hv)] % \newif\if@dtk@newengine \@dtk@newenginetrue % @@ -150,6 +150,10 @@ \let\MFun\MetaFun \def\METAPOST{\hologo{METAPOST}} \def\MetaPost{\hologo{MetaPost}} +\def\mkII{\textsf{mkII}} +\let\mkii\mkII +\def\mkIV{\textsf{mkIV}} +\let\mkiv\mkIV \let\MP\METAPOST \def\MiKTeX{\hologo{MiKTeX}} \def\NTS{\hologo{NTS}} @@ -249,6 +253,4 @@ \let\puth = \PuTh - - \endinput diff --git a/macros/latex/contrib/minimalist/minimalist-classical.sty b/macros/latex/contrib/minimalist/minimalist-classical.sty index 5851a6b92f..5fd710c03e 100644 --- a/macros/latex/contrib/minimalist/minimalist-classical.sty +++ b/macros/latex/contrib/minimalist/minimalist-classical.sty @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {minimalist-classical} - {2022/04/17} {} + {2022/04/24} {} {The classical style of minimalist} \@ifpackageloaded { minimalist } {} @@ -264,7 +264,7 @@ %%================================ %% Title format %%================================ -\RequirePackage [ explicit, newparttoc, nobottomtitles ] { titlesec } +\RequirePackage [ explicit, newparttoc, nobottomtitles* ] { titlesec } \PassOptionsToPackage { normalem } { ulem } \RequirePackage { ulem } @@ -511,7 +511,7 @@ %% Lists %%================================ \RequirePackage { enumitem } -\setlistdepth{9} +\setlistdepth{10} \setlist{noitemsep, topsep=.33\topsep} \setlist[enumerate]{labelsep=*, leftmargin=*} \setlist[enumerate,1]{label=\arabic*$)$, @@ -527,17 +527,13 @@ \hspace{\labelsep}\normalfont\desculine{#1} } -\setlist[itemize]{leftmargin=*} +\renewlist{itemize}{itemize}{10} +\setlist[itemize]{leftmargin=*,label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\cdot$}} \AddLanguageSetting { \setlist[itemize,1]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\bullet$}} } \AddLanguageSetting [french] { \setlist[itemize,1]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{---}} } \setlist[itemize,2]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{--}} \setlist[itemize,3]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\circ$}} \setlist[itemize,4]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\ast$}} -\setlist[itemize,5]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\cdot$}} -\setlist[itemize,6]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\cdot$}} -\setlist[itemize,7]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\cdot$}} - -\renewlist{itemize}{itemize}{9} %%================================ %% Blank page @@ -669,9 +665,10 @@ heading_suffix "}\n" {\normalfont}{} {\newline} { \global\let\qedsymbol\simpleqedsymbol - {\thmname{#1}\thmnumber{\nobreakspace #2}} - \thmnote{\hspace{.4em}\textcolor{main-text!27!paper}{ \l_minimalist_sep_bar }\hspace{.4em}\color{main-text!50!paper}$($#3$)$} - \smallskip + \rlap{\vbox{\hbox{\parbox{\linewidth}{ + {\thmname{#1}\thmnumber{\nobreakspace #2}} + \thmnote{\hspace{.4em}\textcolor{main-text!27!paper}{ \l_minimalist_sep_bar }\hspace{.4em}\color{main-text!50!paper}$($#3$)$} + }}\hbox{\strut}\vspace{-2\parskip}}} \pushQED{\qed} } } @@ -853,41 +850,6 @@ heading_suffix "}\n" \RequirePackage { tcolorbox } \bool_if:NT \l__minimalist_fast_bool { \tcbstartdraftmode } -\bool_if:NF \l__minimalist_fast_bool - { - \bool_if:NT \l__minimalist_theorem_in_new_line_bool - { - \cs_new_protected:Nn \minimclass_box_environment:n - { - \hook_gput_code:nnn { env/#1/before } { minimalist } - { - \LocallyStopLineNumbers - \begin { tcolorbox } - [ - enhanced~jigsaw, - frame~hidden, - interior~hidden, - top = 0pt, bottom = 0pt, - left = 0pt, right = 0pt, - boxrule = 0pt, boxsep = 0pt, - before~skip = \parskip+\topsep+.25\baselineskip, - after~skip = \parskip+\topsep+.25\baselineskip, - enforce~breakable, lines~before~break=3, - ] - } - \hook_gput_code:nnn { env/#1/after } { minimalist } - { - \end { tcolorbox } - \ResumeLineNumbers - } - } - \exp_args:No \clist_map_inline:nn { \c_projlib_theorem_supported_clist } - { - \minimclass_box_environment:n { #1 } - \minimclass_box_environment:n { #1 * } - } - } - } \NewDocumentEnvironment { emphasis } { } { @@ -895,11 +857,12 @@ heading_suffix "}\n" \enlargethispage{2mm} \begin{tcolorbox} [ - enhanced ~ jigsaw, enforce~breakable, oversize, + enhanced ~ jigsaw, breakable, oversize, % nobeforeafter, left = .5em, right=0mm, top=0.5mm, bottom=0mm, boxrule=0pt, - colback=main-text!2!paper, frame ~ hidden, - borderline ~ west = {.3em} {0mm} {main-text!25!paper}, arc = 0.2mm, + colback = paper, frame ~ hidden, + borderline ~ west = {.125em} {-.5mm} {main-text!25!paper, double, double ~ distance=.1em}, + arc = 0.2mm, ] } { diff --git a/macros/latex/contrib/minimalist/minimalist-doc.pdf b/macros/latex/contrib/minimalist/minimalist-doc.pdf Binary files differindex e79171997e..f890924979 100644 --- a/macros/latex/contrib/minimalist/minimalist-doc.pdf +++ b/macros/latex/contrib/minimalist/minimalist-doc.pdf diff --git a/macros/latex/contrib/minimalist/minimalist-doc.tex b/macros/latex/contrib/minimalist/minimalist-doc.tex index abf1a3528a..199f6ca675 100644 --- a/macros/latex/contrib/minimalist/minimalist-doc.tex +++ b/macros/latex/contrib/minimalist/minimalist-doc.tex @@ -97,7 +97,7 @@ %%================================ \begin{document} -\def\PackageVersion{2022/04/17} +\def\PackageVersion{2022/04/24} \title{\minimalist{}, write your articles or books in a simple and clear way} \author{Jinwen XU} diff --git a/macros/latex/contrib/minimalist/minimalist-plain.sty b/macros/latex/contrib/minimalist/minimalist-plain.sty index 5be7970316..28dbd470e8 100644 --- a/macros/latex/contrib/minimalist/minimalist-plain.sty +++ b/macros/latex/contrib/minimalist/minimalist-plain.sty @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {minimalist-plain} - {2022/04/17} {} + {2022/04/24} {} {The plain style of minimalist} \@ifpackageloaded { minimalist } {} @@ -250,7 +250,7 @@ %%================================ %% Title format %%================================ -\RequirePackage [ explicit, newparttoc, nobottomtitles ] { titlesec } +\RequirePackage [ explicit, newparttoc, nobottomtitles* ] { titlesec } \PassOptionsToPackage { normalem } { ulem } \RequirePackage { ulem } @@ -485,7 +485,7 @@ %% Lists %%================================ \RequirePackage { enumitem } -\setlistdepth{9} +\setlistdepth{10} \setlist{noitemsep, topsep=.33\topsep} \setlist[enumerate]{labelsep=*, leftmargin=*} \setlist[enumerate,1]{label=\arabic*$)$, @@ -496,17 +496,13 @@ ref = \arabic{enumi}.\emph{\roman{enumii}}.\emph{\alph*}$)$} \setlist[description]{font=\normalfont\minimalist_bfseries:} -\setlist[itemize]{leftmargin=*} +\renewlist{itemize}{itemize}{10} +\setlist[itemize]{leftmargin=*,label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\cdot$}} \AddLanguageSetting { \setlist[itemize,1]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\bullet$}} } \AddLanguageSetting [french] { \setlist[itemize,1]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{---}} } \setlist[itemize,2]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{--}} \setlist[itemize,3]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\circ$}} \setlist[itemize,4]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\ast$}} -\setlist[itemize,5]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\cdot$}} -\setlist[itemize,6]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\cdot$}} -\setlist[itemize,7]{label=\colorlet{currentcolor}{.}\textcolor{currentcolor!27!paper}{$\cdot$}} - -\renewlist{itemize}{itemize}{9} %%================================ %% Blank page @@ -631,12 +627,16 @@ heading_suffix "}\n" \bool_if:NTF \l__minimalist_theorem_in_new_line_bool { \newtheoremstyle{simple} - {}{} + {.75\baselineskip}{} {\normalfont}{} {\normalfont}{} - {\newline} - {{\thmname{#1}\thmnumber{\nobreakspace #2}} - {\color{main-text!50!paper}\thmnote{\hspace{.4em}$($#3$)$}}\smallskip} + {0pt} + { + \rlap{\vbox{\hbox{\parbox{\linewidth}{ + {\thmname{#1}\thmnumber{\nobreakspace #2}} + {\color{main-text!50!paper}\thmnote{\hspace{.4em}$($#3$)$}} + }}\hbox{\strut}\vspace{-2\parskip}}} + } } { \newtheoremstyle{simple} @@ -809,41 +809,6 @@ heading_suffix "}\n" \RequirePackage { tcolorbox } \bool_if:NT \l__minimalist_fast_bool { \tcbstartdraftmode } -\bool_if:NF \l__minimalist_fast_bool - { - \bool_if:NT \l__minimalist_theorem_in_new_line_bool - { - \cs_new_protected:Nn \minimclass_box_environment:n - { - \hook_gput_code:nnn { env/#1/before } { minimalist } - { - \LocallyStopLineNumbers - \begin { tcolorbox } - [ - enhanced~jigsaw, - frame~hidden, - interior~hidden, - top = 0pt, bottom = 0pt, - left = 0pt, right = 0pt, - boxrule = 0pt, boxsep = 0pt, - before~skip = \parskip+\topsep+.25\baselineskip, - after~skip = \parskip+\topsep+.25\baselineskip, - enforce~breakable, lines~before~break=3, - ] - } - \hook_gput_code:nnn { env/#1/after } { minimalist } - { - \end { tcolorbox } - \ResumeLineNumbers - } - } - \exp_args:No \clist_map_inline:nn { \c_projlib_theorem_supported_clist } - { - \minimclass_box_environment:n { #1 } - \minimclass_box_environment:n { #1 * } - } - } - } \NewDocumentEnvironment { emphasis } { } { @@ -851,11 +816,12 @@ heading_suffix "}\n" \enlargethispage{2mm} \begin{tcolorbox} [ - enhanced ~ jigsaw, enforce~breakable, oversize, + enhanced ~ jigsaw, breakable, oversize, % nobeforeafter, left = .5em, right=0mm, top=0.5mm, bottom=0mm, boxrule=0pt, colback=main-text!2!paper, frame ~ hidden, - borderline ~ west = {.3em} {0mm} {main-text!25!paper}, arc = 0.2mm, + borderline ~ west = {.3em} {0mm} {main-text!25!paper}, + arc = 0.2mm, ] } { diff --git a/macros/latex/contrib/minimalist/minimalist.sty b/macros/latex/contrib/minimalist/minimalist.sty index cb3875ea42..7dde7289fe 100644 --- a/macros/latex/contrib/minimalist/minimalist.sty +++ b/macros/latex/contrib/minimalist/minimalist.sty @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplPackage {minimalist} - {2022/04/17} {} + {2022/04/24} {} {A simple and clear style for articles and books} \keys_define:nn { minimalist } diff --git a/macros/latex/contrib/minimalist/minimart.cls b/macros/latex/contrib/minimalist/minimart.cls index 547db8a3c5..aaa62d7852 100644 --- a/macros/latex/contrib/minimalist/minimart.cls +++ b/macros/latex/contrib/minimalist/minimart.cls @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplClass {minimart} - {2022/04/17} {} + {2022/04/24} {} {A simple and clear article style} \tl_const:Nn \l__minimclass_base_class_tl { article } @@ -96,6 +96,7 @@ total = { 5.535in, 8.300in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } \bool_if:NT \l__minimclass_b_five_paper_bool @@ -106,6 +107,7 @@ total = { 5.535in, 8.160in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } } @@ -117,6 +119,7 @@ total = { 6.500in, 9.685in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } } @@ -189,7 +192,24 @@ \PassOptionsToPackage { all } { nowidow } \RequirePackage { nowidow } -\RequirePackage { embrac } + +\RequirePackage { regexpatch } +\skip_new:N \g_minimclass_parfillskip_skip +\xpatchcmd{\@trivlist}{\@flushglue}{\g_minimclass_parfillskip_skip}{}{} +\hook_gput_code:nnn { begindocument } { minimclass } + { + \skip_gset:Nn \g_minimclass_parfillskip_skip { 0pt plus \dim_eval:n { \linewidth - 2\parindent } } + \skip_gset_eq:NN \parfillskip \g_minimclass_parfillskip_skip + } + +\hook_gput_code:nnn { begindocument/before } { minimclass } + { + \@ifpackageloaded { biblatex } + { + \PassOptionsToPackage { biblatex } { embrac } + } {} + \RequirePackage { embrac } + } %%================================ %% Graphics diff --git a/macros/latex/contrib/minimalist/minimbook.cls b/macros/latex/contrib/minimalist/minimbook.cls index 03068626d6..61a27b439c 100644 --- a/macros/latex/contrib/minimalist/minimbook.cls +++ b/macros/latex/contrib/minimalist/minimbook.cls @@ -19,7 +19,7 @@ \RequirePackage{l3keys2e} \ProvidesExplClass {minimbook} - {2022/04/17} {} + {2022/04/24} {} {A simple and clear book style} \tl_const:Nn \l__minimclass_base_class_tl { book } @@ -96,6 +96,7 @@ total = { 5.535in, 8.300in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } \bool_if:NT \l__minimclass_b_five_paper_bool @@ -106,6 +107,7 @@ total = { 5.535in, 8.160in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } } @@ -117,6 +119,7 @@ total = { 6.500in, 9.685in }, centering, footnotesep = 2em plus 2pt minus 2pt, + footskip = .5in, } } @@ -189,7 +192,24 @@ \PassOptionsToPackage { all } { nowidow } \RequirePackage { nowidow } -\RequirePackage { embrac } + +\RequirePackage { regexpatch } +\skip_new:N \g_minimclass_parfillskip_skip +\xpatchcmd{\@trivlist}{\@flushglue}{\g_minimclass_parfillskip_skip}{}{} +\hook_gput_code:nnn { begindocument } { minimclass } + { + \skip_gset:Nn \g_minimclass_parfillskip_skip { 0pt plus \dim_eval:n { \linewidth - 2\parindent } } + \skip_gset_eq:NN \parfillskip \g_minimclass_parfillskip_skip + } + +\hook_gput_code:nnn { begindocument/before } { minimclass } + { + \@ifpackageloaded { biblatex } + { + \PassOptionsToPackage { biblatex } { embrac } + } {} + \RequirePackage { embrac } + } %%================================ %% Graphics diff --git a/macros/latex/contrib/projlib/ProjLib.dtx b/macros/latex/contrib/projlib/ProjLib.dtx index c9d214f9e1..b7e1189fb0 100644 --- a/macros/latex/contrib/projlib/ProjLib.dtx +++ b/macros/latex/contrib/projlib/ProjLib.dtx @@ -20,77 +20,77 @@ %<*ProjLib> \ProvidesExplPackage {ProjLib} - {2022/04/18} {} + {2022/04/24} {} {Collective interface of the ProjLib toolkit} %</ProjLib> % %<*projlib-author> \ProvidesExplPackage {projlib-author} - {2022/04/18} {} + {2022/04/24} {} {Enhanced author information block} %</projlib-author> % %<*projlib-datetime> \ProvidesExplPackage {projlib-datetime} - {2022/04/18} {} + {2022/04/24} {} {Convert numeric date-time string to natural language} %</projlib-datetime> % %<*projlib-draft> \ProvidesExplPackage {projlib-draft} - {2022/04/18} {} + {2022/04/24} {} {Useful commands during draft stage} %</projlib-draft> % %<*projlib-font> \ProvidesExplPackage {projlib-font} - {2022/04/18} {} + {2022/04/24} {} {Font selection and configuration} %</projlib-font> % %<*projlib-language> \ProvidesExplPackage {projlib-language} - {2022/04/18} {} + {2022/04/24} {} {Multi-language configuration} %</projlib-language> % %<*projlib-logo> \ProvidesExplPackage {projlib-logo} - {2022/04/18} {} + {2022/04/24} {} {The ProjLib logo} %</projlib-logo> % %<*projlib-math> \ProvidesExplPackage {projlib-math} - {2022/04/18} {} + {2022/04/24} {} {Efficient math setup} %</projlib-math> % %<*projlib-paper> \ProvidesExplPackage {projlib-paper} - {2022/04/18} {} + {2022/04/24} {} {Configuration of the paper style} %</projlib-paper> % %<*projlib-theorem> \ProvidesExplPackage {projlib-theorem} - {2022/04/18} {} + {2022/04/24} {} {Configuration of theorem-like environments} %</projlib-theorem> % %<*projlib-titlepage> \ProvidesExplPackage {projlib-titlepage} - {2022/04/18} {} + {2022/04/24} {} {Commands for rendering the title page} %</projlib-titlepage> @@ -2129,6 +2129,7 @@ \RequirePackage { projlib-language } \RequirePackage { xcolor } +\PassOptionsToPackage { normalem } { ulem } \RequirePackage { ulem } \cs_new_protected:Nn \projlib_draft_plain_box_lines:n @@ -2254,6 +2255,7 @@ \group_end: \tl_gput_right:Nn \g__projlib_draft_DNF_report_tl { + \setlength { \parfillskip } { 0pt plus 1fil } \noindent \# \, } @@ -2787,6 +2789,8 @@ \PassOptionsToPackage { italian, brazilian, spanish, ngerman, french, english } { cleveref } \RequirePackage { babel } +\RequirePackage { silence } +\WarningFilter { biblatex } { Language } \bool_if:NT \g__projlib_language_enabled_french_bool { @@ -3736,8 +3740,10 @@ assertion , assumption , axiom , + claim , conclusion , conjecture , + construction , convention , corollary , definition , @@ -3753,6 +3759,7 @@ property , proposition , question , + recall , remark , theorem , definition-proposition , @@ -3799,6 +3806,8 @@ \RequirePackage { amsthm } \RequirePackage { create-theorem } +\RenewCommandCopy \cref \crefthe +\RenewCommandCopy \Cref \Crefthe \bool_if:NF \l__projlib_theorem_no_theorems_bool { @@ -4047,7 +4056,7 @@ , spanish = Aserción , schinese = 断言 , tchinese = 斷言 - , japanese = アサーション + , japanese = 断言 , russian = Утверждение } , crefname = { @@ -4060,7 +4069,7 @@ , spanish = [la]{Aserción}[las]{Aserción} , schinese = {断言}{断言} , tchinese = {斷言}{斷言} - , japanese = {アサーション}{アサーション} + , japanese = {断言}{断言} , russian = {Утверждение}{Утверждение} } , Crefname = { @@ -4073,7 +4082,7 @@ , spanish = [La]{Aserción}[Las]{Aserción} , schinese = {断言}{断言} , tchinese = {斷言}{斷言} - , japanese = {アサーション}{アサーション} + , japanese = {断言}{断言} , russian = {Утверждение}{Утверждение} } } @@ -4164,6 +4173,49 @@ } } +\NameTheorem { claim } + { + , heading = { + , english = Claim + , french = Affirmation + , ngerman = Affirmation + , italian = Affermazione + , portuguese = Afirmação + , brazilian = Afirmação + , spanish = Afirmación + , schinese = 断言 + , tchinese = 斷言 + , japanese = 断言 + , russian = Утверждение + } + , crefname = { + , english = {Claim}{Claim} + , french = [l']{Affirmation}[les]{Affirmation} + , ngerman = {Affirmation}{Affirmation} + , italian = [l']{Affermazione}[le]{Affermazione} + , portuguese = [a]{Afirmação}[as]{Afirmação} + , brazilian = [a]{Afirmação}[as]{Afirmação} + , spanish = [la]{Afirmación}[las]{Afirmación} + , schinese = {断言}{断言} + , tchinese = {斷言}{斷言} + , japanese = {断言}{断言} + , russian = {Утверждение}{Утверждение} + } + , Crefname = { + , english = {Claim}{Claim} + , french = [L']{Affirmation}[Les]{Affirmation} + , ngerman = {Affirmation}{Affirmation} + , italian = [L']{Affermazione}[Le]{Affermazione} + , portuguese = [A]{Afirmação}[As]{Afirmação} + , brazilian = [A]{Afirmação}[As]{Afirmação} + , spanish = [La]{Afirmación}[Las]{Afirmación} + , schinese = {断言}{断言} + , tchinese = {斷言}{斷言} + , japanese = {断言}{断言} + , russian = {Утверждение}{Утверждение} + } + } + \NameTheorem { conclusion } { , heading = { @@ -4250,6 +4302,49 @@ } } +\NameTheorem { construction } + { + , heading = { + , english = Construction + , french = Construction + , ngerman = Konstruktion + , italian = Costruzione + , portuguese = Construção + , brazilian = Construção + , spanish = Construcción + , schinese = 构造 + , tchinese = 構造 + , japanese = 構造 + , russian = Конструкция + } + , crefname = { + , english = {Construction}{Construction} + , french = [la]{Construction}[les]{Construction} + , ngerman = {Konstruktion}{Konstruktion} + , italian = [la]{Costruzione}[le]{Costruzione} + , portuguese = [a]{Construção}[as]{Construção} + , brazilian = [a]{Construção}[as]{Construção} + , spanish = [la]{Construcción}[las]{Construcción} + , schinese = {构造}{构造} + , tchinese = {構造}{構造} + , japanese = {構造}{構造} + , russian = {Конструкция}{Конструкция} + } + , Crefname = { + , english = {Construction}{Construction} + , french = [La]{Construction}[Les]{Construction} + , ngerman = {Konstruktion}{Konstruktion} + , italian = [La]{Costruzione}[Le]{Costruzione} + , portuguese = [A]{Construção}[As]{Construção} + , brazilian = [A]{Construção}[As]{Construção} + , spanish = [La]{Construcción}[Las]{Construcción} + , schinese = {构造}{构造} + , tchinese = {構造}{構造} + , japanese = {構造}{構造} + , russian = {Конструкция}{Конструкция} + } + } + \NameTheorem { convention } { , heading = { @@ -4895,6 +4990,49 @@ } } +\NameTheorem { recall } + { + , heading = { + , english = Recall + , french = Rappel + , ngerman = Rückruf + , italian = Richiamo + , portuguese = Recordação + , brazilian = Recordação + , spanish = Recuerdo + , schinese = 回顾 + , tchinese = 回顧 + , japanese = 回顧 + , russian = Напоминание + } + , crefname = { + , english = {Recall}{Recall} + , french = [le]{Rappel}[les]{Rappel} + , ngerman = {Rückruf}{Rückruf} + , italian = [il]{Richiamo}[i]{Richiamo} + , portuguese = [a]{Recordação}[as]{Recordação} + , brazilian = [a]{Recordação}[as]{Recordação} + , spanish = [el]{Recuerdo}[los]{Recuerdo} + , schinese = {回顾}{回顾} + , tchinese = {回顧}{回顧} + , japanese = {回顧}{回顧} + , russian = {Напоминание}{Напоминание} + } + , Crefname = { + , english = {Recall}{Recall} + , french = [Le]{Rappel}[Les]{Rappel} + , ngerman = {Rückruf}{Rückruf} + , italian = [Il]{Richiamo}[I]{Richiamo} + , portuguese = [A]{Recordação}[As]{Recordação} + , brazilian = [A]{Recordação}[As]{Recordação} + , spanish = [El]{Recuerdo}[Los]{Recuerdo} + , schinese = {回顾}{回顾} + , tchinese = {回顧}{回顧} + , japanese = {回顧}{回顧} + , russian = {Напоминание}{Напоминание} + } + } + \NameTheorem { remark } { , heading = { diff --git a/macros/latex/contrib/projlib/README.md b/macros/latex/contrib/projlib/README.md index 5e01250d23..28af8bc40b 100644 --- a/macros/latex/contrib/projlib/README.md +++ b/macros/latex/contrib/projlib/README.md @@ -6,7 +6,7 @@ > **ProjLib** can be interpreted as "***Proj**ect **Lib**rary*" (in English), or as "***Proj**et **Lib**re*" (in French, meaning "*Free Project*"). -**This bundle is dated 2022/04/18. Please note that the documentations are not yet up-to-date.** +> **This bundle is dated 2022/04/24. Please note that the documentations are not yet up-to-date.** ## Introduction @@ -55,7 +55,7 @@ The modules include: - In particular, supporting the modes `name as is` and `name as context` for referencing names. - Supporting the modes `simple name` and `complex name` for the referencing names. - `\SwitchTheoremNumbering` and `\DisableTheoremNumbering` for manipulating the numbering. - - Preset environments include: `assertion`, `assumption`, `axiom`, `conclusion`, `conjecture`, `convention`, `corollary`, `definition`, `definition-proposition`, `definition-theorem`, `example`, `exercise`, `fact`, `hypothesis`, `lemma`, `notation`, `observation`, `postulate`, `problem`, `property`, `proposition`, `question`, `remark`, `theorem`, and the corresponding unnumbered version with an asterisk `*` in the name. + - Preset environments include: `application`, `assertion`, `assumption`, `axiom`, `claim`, `conclusion`, `conjecture`, `construction`, `convention`, `corollary`, `definition`, `definition-proposition`, `definition-theorem`, `example`, `exercise`, `fact`, `hypothesis`, `lemma`, `notation`, `observation`, `postulate`, `problem`, `property`, `proposition`, `question`, `recall`, `remark`, `theorem`, and the corresponding unnumbered version with an asterisk `*` in the name. 1. module `titlepage` - *Commands for rendering the title page* - Currently support two title page styles: `default` and `simple`. diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md index cec77aae34..c0810e829b 100644 --- a/macros/latex/contrib/siunitx/CHANGELOG.md +++ b/macros/latex/contrib/siunitx/CHANGELOG.md @@ -7,6 +7,46 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.1.0] - 2022-04-25 + +### Added +- Support for complex numbers in polar form both as input and output +- Support for multiple uncertainty values in both short and long form + in input, and supporting options `uncertainty-descriptors`, + `uncertainty-descriptor-mode` and `uncertainty-descriptor-separator` +- Options `text-subscript-command` and `text-superscript-command` to allow + customisation of script printing in text mode (see issue + [\#595](https://github.com/josephwright/siunitx/issues/595)) +- Options `complex-angle-unit`, `complex-mode`, `complex-symbol-angle`, + and `complex-symbol-degree` to support complex numbers in polar form +- Options `digit-group-size`, `digit-group-first-size` and + `digit-group-other-size` to control digit grouping +- Options `display-per-mode` and `inline-per-mode` to offer additional + flexiblity in `per-mode` control +- Option `per-symbol-script-correction` +- Option `power-half-as-sqrt` +- Option `retain-negative-zero` +- Option `round-zero-positive` to control the outcome of rounding + negative values to zero +- Options `zero-decimal-as-symbol` and `zero-symbol` to support conversion of + a zero decimal part to a dash or other symbol +- Option setting `per-mode = single-symbol` to allow exactly one symbol to be + present +- Unit abbreviations `\C`, `\nC`, `\uC`, `\mC` (see issue + [\#575](https://github.com/josephwright/siunitx/issues/575)) +- Unit abbreviations `\fH` and `\pH` (see issue + [\#596](https://github.com/josephwright/siunitx/issues/596)) +- Unit abbreviation `\nW` (see issue + [\#596](https://github.com/josephwright/siunitx/issues/596)) +- Brazilian and Portuguese translations for lists and ranges (see issue + [\#514](https://github.com/josephwright/siunitx/issues/514)) + +### Changed +- Issue an error if the `units` package is loaded + +### Deprecated +- Option setting `per-mode = symbol-or-fraction` + ## [v3.0.50] - 2022-04-04 ### Fixed @@ -1729,7 +1769,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ### Added - First public testing release (as `si`) -[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.50...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.1.0...HEAD +[v3.1.0]: https://github.com/josephwright/siunitx/compare/v3.0.50...v3.1.0 [v3.0.50]: https://github.com/josephwright/siunitx/compare/v3.0.49...v3.0.50 [v3.0.49]: https://github.com/josephwright/siunitx/compare/v3.0.48...v3.0.49 [v3.0.48]: https://github.com/josephwright/siunitx/compare/v3.0.47...v3.0.48 diff --git a/macros/latex/contrib/siunitx/siunitx-abbreviation.dtx b/macros/latex/contrib/siunitx/siunitx-abbreviation.dtx index 9fc5ddb2a5..debc9f2a6b 100644 --- a/macros/latex/contrib/siunitx/siunitx-abbreviation.dtx +++ b/macros/latex/contrib/siunitx/siunitx-abbreviation.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-abbreviation.dtx Copyright (C) 2018,2019 Joseph Wright +% File: siunitx-abbreviation.dtx Copyright (C) 2018,2019,2021,2022 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -94,7 +94,7 @@ % Abbreviations for volumes. % \end{function} % -% \begin{function}{\W, \uW, \mW, \kW, \MW, \GW} +% \begin{function}{\W, \nW, \uW, \mW, \kW, \MW, \GW} % Abbreviations for powers. % \end{function} % @@ -118,6 +118,14 @@ % Abbreviations for capacitance. % \end{function} % +% \begin{function}{\H, \fH, \pH, \nH, \uH, \mH} +% Abbreviations for inductance. +% \end{function} +% +% \begin{function}{\C, \nC \uC, \mC} +% Abbreviations for charge. +% \end{function} +% % \begin{function}{\dB} % Abbreviation for decibel. % \end{function} @@ -214,7 +222,7 @@ % \end{macro} % \begin{macro} % { -% \W, \uW, \mW, \kW, \MW, \GW, +% \W, \nW, \uW, \mW, \kW, \MW, \GW, % \kJ, \J, \mJ, \uJ, % \eV, \meV, \keV, \MeV, \GeV, \TeV, % \kWh @@ -222,6 +230,7 @@ % Energies and powers % \begin{macrocode} \siunitx_declare_unit:Nn \W { \watt } +\siunitx_declare_unit:Nn \nW { \nano \watt } \siunitx_declare_unit:Nn \uW { \micro \watt } \siunitx_declare_unit:Nn \mW { \milli \watt } \siunitx_declare_unit:Nn \kW { \kilo \watt } @@ -275,12 +284,24 @@ \siunitx_declare_unit:Nn \uF { \micro \farad } % \end{macrocode} % \end{macro} -% \begin{macro}{\H, \mH, \uH} -% Capacitance. +% \begin{macro}{\H, \fH, \pH, \nH, \uH, \mH} +% Inductance. +% \begin{macrocode} +\siunitx_declare_unit:Nn \H { \henry } +\siunitx_declare_unit:Nn \fH { \femto \henry } +\siunitx_declare_unit:Nn \pH { \pico \henry } +\siunitx_declare_unit:Nn \nH { \nano \henry } +\siunitx_declare_unit:Nn \uH { \micro \henry } +\siunitx_declare_unit:Nn \mH { \milli \henry } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\C, \nC, \uC, \mC} +% Charge. % \begin{macrocode} -\siunitx_declare_unit:Nn \H { \henry } -\siunitx_declare_unit:Nn \mH { \milli \henry } -\siunitx_declare_unit:Nn \uH { \micro \henry } +\siunitx_declare_unit:Nn \C { \coulomb } +\siunitx_declare_unit:Nn \nC { \nano \coulomb } +\siunitx_declare_unit:Nn \uC { \micro \coulomb } +\siunitx_declare_unit:Nn \mC { \milli \coulomb } % \end{macrocode} % \end{macro} % \begin{macro}{\N, \mN, \kN, \MN} diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf Binary files differindex 6b05035a14..a91ddf0a36 100644 --- a/macros/latex/contrib/siunitx/siunitx-code.pdf +++ b/macros/latex/contrib/siunitx/siunitx-code.pdf diff --git a/macros/latex/contrib/siunitx/siunitx-code.tex b/macros/latex/contrib/siunitx/siunitx-code.tex index bf2bd1b7e9..a4c3978310 100644 --- a/macros/latex/contrib/siunitx/siunitx-code.tex +++ b/macros/latex/contrib/siunitx/siunitx-code.tex @@ -1,6 +1,6 @@ \iffalse meta-comment -File: siunitx-code.tex Copyright (C) 2016-2021 Joseph Wright +File: siunitx-code.tex Copyright (C) 2016-2022 Joseph Wright It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -34,9 +34,19 @@ for those people who are interested. % Commands for this document \ExplSyntaxOn -\cs_new_eq:NN \LowerCaseText \tl_lower_case:n +\makeatletter +\NewDocumentCommand \acro { m } + { + \textsc + { + \exp_args:NV \tl_if_head_eq_charcode:nNTF \f@series { m } + { \text_lowercase:n } + { \use:n } + {#1} + } + } +\makeatother \ExplSyntaxOff -\NewDocumentCommand\acro{m}{\textsc{\LowerCaseText{#1}}} \NewDocumentCommand\foreign{m}{\textit{#1}} % Standard settings diff --git a/macros/latex/contrib/siunitx/siunitx-complex.dtx b/macros/latex/contrib/siunitx/siunitx-complex.dtx index d81e27f4ac..9cd595d28f 100644 --- a/macros/latex/contrib/siunitx/siunitx-complex.dtx +++ b/macros/latex/contrib/siunitx/siunitx-complex.dtx @@ -71,16 +71,59 @@ % \end{syntax} % Parses the \meta{number} and splits into real and complex parts, which are % then formatted as described for \cs{siunitx_number_format:nN}. The results -% are combined and printed using the standard functions in the module. +% are combined and printed using the standard functions in the module. If +% the setting \opt{complex-mode} is set to \meta{polar}, the input is +% parsed, converted to polar form and then passed to +% \cs{siunitx_complex_number:nn}. This parsing requires that the complex root +% is given as \texttt{i} at the \emph{end} of the value. % \end{function} % -% \begin{function}{\siunitx_complex_quantity:nn} +% \begin{function}{\siunitx_complex_number:nn} % \begin{syntax} -% \cs{siunitx_complex_quantity:n} \Arg{number} \Arg{units} +% \cs{siunitx_complex_number:nn} \Arg{magnitude} \Arg{angle} % \end{syntax} -% Parses the \meta{number} and splits into real and complex parts, which are -% then formatted as described for \cs{siunitx_quantity:nn}. The results -% are combined and printed using the standard functions in the module. +% Parses the \meta{magnitude} and \meta{angle} and then formats each as +% described for \cs{siunitx_number_format:nN}. The two are separated by the +% angle symbol, which is treated as a numerical part. If +% \opt{complex-angle-unit} is set to \opt{degrees} then the unit symbol is +% added: this is printed as a unit in the usual way. If +% the setting \opt{complex-mode} is set to \meta{cartesian}, the input is +% parsed, converted to Cartesian form and then passed to +% \cs{siunitx_complex_number:n}. +% \end{function} +% +% \begin{function}{\siunitx_complex_quantity:nn, \siunitx_complex_quantity:nnn} +% \begin{syntax} +% \cs{siunitx_complex_quantity:nn} \Arg{number} \Arg{units} +% \cs{siunitx_complex_quantity:nnn} \Arg{magnitude} \Arg{angle} \Arg{units} +% \end{syntax} +% These functions treat their numerical argument(s) as described +% for the corresponding \texttt{number} functions. They then typeset the +% entire numerical part and the unit as described for \cs{siunitx_quantity:nn}. +% \end{function} +% +% \begin{function}{complex-angle-unit} +% \begin{syntax} +% |complex-angle-unit| = |degrees|\verb"|"|radians| +% \end{syntax} +% Sets how the unit for polar complex numbers is treated. This setting +% is used to determine how polar \emph{input} is interpreted, how +% conversion to polar form works and how output in polar form is typeset. +% The standard setting is |degrees|. +% \end{function} +% +% \begin{function}{complex-mode} +% \begin{syntax} +% |complex-mode| = |cartesian|\verb"|"|input|\verb"|"|polar| +% \end{syntax} +% Selects how complex values are formatted: a choice from the options +% |cartesian|, |input| and |polar|. The option |cartesian| means that +% complex values will always be typeset in cartesian ($x + y\mathrm{i}$) +% format, whilst |polar| means that complex are typeset as a magnitude +% and angle. Finally, |input| setting means that the input format +% (\foreign{i.e.}~difference between \cs{siunitx_complex_number:n} and +% \cs{siunitx_complex_number:nn}) is maintained. The standard setting is +% |input|. % \end{function} % % \begin{function}{complex-root-position} @@ -91,6 +134,20 @@ % to the numbers. The standard setting is |after-number|. % \end{function} % +% \begin{function}{complex-symbol-angle} +% \begin{syntax} +% |complex-symbol-angle| = \meta{symbol} +% \end{syntax} +% Sets the symbol used before the polar angle. +% \end{function} +% +% \begin{function}{complex-symbol-degree} +% \begin{syntax} +% |complex-symbol-degree| = \meta{symbol} +% \end{syntax} +% Sets the symbol used for polar degrees. +% \end{function} +% % \begin{function}{input-complex-root} % \begin{syntax} % |input-complex-root| = \meta{tokens} @@ -155,13 +212,21 @@ % \end{variable} % % \begin{variable}{\l_@@_real_tl, \l_@@_img_tl} -% The real and imaginary parts of the number, respectively. +% The real and imaginary parts of cartesian form, respectively. % \begin{macrocode} \tl_new:N \l_@@_real_tl \tl_new:N \l_@@_img_tl % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_mag_tl, \l_@@_angle_tl} +% The magnitude and angle of polar form, respectively. +% \begin{macrocode} +\tl_new:N \l_@@_mag_tl +\tl_new:N \l_@@_angle_tl +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\l_@@_join_tl, \l_@@_sign_tl} % Staging posts for a joining and leading sign, respectively. % \begin{macrocode} @@ -170,16 +235,54 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_input_root_tl, \l_@@_output_root_tl} +% \begin{variable} +% { +% \l_@@_root_after_bool , +% \l_@@_force_cartesian_bool , +% \l_@@_force_polar_bool , +% \l_@@_polar_degree_bool , +% \l_@@_symbol_angle_tl , +% \l_@@_symbol_degree_tl , +% \l_@@_input_root_tl , +% \l_@@_output_root_tl +% } % \begin{macrocode} \bool_new:N \l_@@_root_after_bool +\bool_new:N \l_@@_force_cartesian_bool +\bool_new:N \l_@@_force_polar_bool +\bool_new:N \l_@@_polar_degree_bool \keys_define:nn { siunitx } { + complex-mode .choice: , + complex-mode / cartesian .code:n = + { + \bool_set_true:N \l_@@_force_cartesian_bool + \bool_set_false:N \l_@@_force_polar_bool + } , + complex-mode / polar .code:n = + { + \bool_set_false:N \l_@@_force_cartesian_bool + \bool_set_true:N \l_@@_force_polar_bool + } , + complex-mode / input .code:n = + { + \bool_set_false:N \l_@@_force_cartesian_bool + \bool_set_false:N \l_@@_force_polar_bool + } , + complex-angle-unit .choice: , + complex-angle-unit / degrees .code:n = + { \bool_set_true:N \l_@@_polar_degree_bool } , + complex-angle-unit / radians .code:n = + { \bool_set_false:N \l_@@_polar_degree_bool } , complex-root-position .choice: , complex-root-position / after-number .code:n = { \bool_set_true:N \l_@@_root_after_bool } , complex-root-position / before-number .code:n = { \bool_set_false:N \l_@@_root_after_bool } , + complex-symbol-angle .tl_set:N = + \l_@@_symbol_angle_tl , + complex-symbol-degree .tl_set:N = + \l_@@_symbol_degree_tl , input-complex-root .tl_set:N = \l_@@_input_root_tl , output-complex-root .tl_set:N = @@ -232,40 +335,26 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_parse_check:, \@@_parse_finalise:} -% \begin{macro}{\@@_parse_finalise:N} +% \begin{macro}{\@@_parse_check:} +% \begin{macro}{\@@_parse_check:N} % Now we tidy up and do the main work: passing to the standard formatter for % final parsing. % \begin{macrocode} \cs_new_protected:Npn \@@_parse_check: { - \bool_lazy_all:nTF - { - { \tl_if_empty_p:N \l_@@_real_tl } - { \tl_if_empty_p:N \l_@@_img_tl } - { \tl_if_empty_p:N \l_@@_exp_tl } - } - { - \msg_error:nnx { siunitx } { invalid-complex-number } - { \exp_not:V \l_@@_input_tl } - } - { \@@_parse_finalise: } - } -\cs_new_protected:Npn \@@_parse_finalise: - { \tl_if_empty:NTF \l_@@_img_tl - { \@@_parse_finalise:N \l_@@_real_tl } + { \@@_parse_check:N \l_@@_real_tl } { \tl_if_empty:NTF \l_@@_real_tl - { \@@_parse_finalise:N \l_@@_img_tl } + { \@@_parse_check:N \l_@@_img_tl } { - \@@_parse_finalise:N \l_@@_real_tl + \@@_parse_check:N \l_@@_real_tl \tl_set_eq:NN \l_@@_sign_tl \l_@@_join_tl - \@@_parse_finalise:N \l_@@_img_tl + \@@_parse_check:N \l_@@_img_tl } } } -\cs_new_protected:Npn \@@_parse_finalise:N #1 +\cs_new_protected:Npn \@@_parse_check:N #1 { \tl_set:Nx #1 { @@ -545,6 +634,27 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\@@_parse_polar:nn} +% Almost trivial but repeated in a couple of places so worth an auxiliary. +% \begin{macrocode} +\cs_new_protected:Npn \@@_parse_polar:nn #1#2 + { + \siunitx_number_parse:nN {#1} \l_@@_mag_tl + \group_begin: + \keys_set:nn { siunitx } + { + input-comparators = , + input-exponent-markers = , + input-open-uncertainty = , + input-close-uncertainty = + } + \siunitx_number_format:nN {#2} \l_@@_angle_tl + \exp_args:NNNV \group_end: + \tl_set:Nn \l_@@_angle_tl \l_@@_angle_tl + } +% \end{macrocode} +% \end{macro} +% % \section{Formatting} % % \begin{variable}{\l_@@_bracket_close_tl, \l_@@_bracket_open_tl} @@ -564,41 +674,110 @@ % \end{variable} % % \begin{macro}{\siunitx_complex_number:n} +% \begin{macro}{\siunitx_complex_number:nn, \@@_number:nn} % \begin{macro}{\siunitx_complex_quantity:nn} -% The work here is pretty trivial. +% \begin{macro}{\siunitx_complex_quantity:nnn, \@@_quantity:nnn} +% The work here is pretty trivial: only conversion between forms makes +% things a bit more intricate. % \begin{macrocode} \cs_new_protected:Npn \siunitx_complex_number:n #1 { - \group_begin: - \bool_if:NTF \l_siunitx_number_parse_bool - { - \@@_parse:nNN {#1} \l_@@_real_tl \l_@@_img_tl - \@@_format:n { } - } - { - \siunitx_number_format:nN {#1} \l_@@_tmp_tl - \siunitx_print_number:V \l_@@_tmp_tl - } - \group_end: + \bool_if:NTF \l_@@_force_polar_bool + { + \use:e + { + \siunitx_complex_number:nn + \@@_convert_polar:n {#1} + } + } + { + \bool_if:NTF \l_siunitx_number_parse_bool + { + \@@_parse:nNN {#1} \l_@@_real_tl \l_@@_img_tl + \@@_format_cartesian:n { } + } + { + \siunitx_number_format:nN {#1} \l_@@_tmp_tl + \siunitx_print_number:V \l_@@_tmp_tl + } + } + } +\cs_new_protected:Npn \siunitx_complex_number:nn #1#2 + { + \bool_lazy_or:nnTF + { \tl_if_blank_p:n {#1} } + { \tl_if_blank_p:n {#2} } + { + \msg_error:nnnn { siunitx } { invalid-polar-form } + {#1} {#2} + } + { \@@_number:nn {#1} {#2} } + } +\cs_new_protected:Npn \@@_number:nn #1#2 + { + \bool_if:NTF \l_@@_force_cartesian_bool + { + \exp_args:Ne \siunitx_complex_number:n + { \@@_convert_cartesian:nn {#1} {#2} } + } + { + \@@_parse_polar:nn {#1} {#2} + \@@_format_polar:n { } + } } \cs_new_protected:Npn \siunitx_complex_quantity:nn #1#2 { - \group_begin: - \bool_if:NTF \l_siunitx_number_parse_bool - { - \@@_parse:nNN {#1} \l_@@_real_tl \l_@@_img_tl - \@@_format:n {#2} - } - { \siunitx_quantity:nn {#1} {#2} } - \group_end: + \bool_if:NTF \l_@@_force_polar_bool + { + \use:e + { + \siunitx_complex_quantity:nnn + \@@_convert_polar:n {#1} + } + {#2} + } + { + \bool_if:NTF \l_siunitx_number_parse_bool + { + \@@_parse:nNN {#1} \l_@@_real_tl \l_@@_img_tl + \@@_format_cartesian:n {#2} + } + { \siunitx_quantity:nn {#1} {#2} } + } + } +\cs_new_protected:Npn \siunitx_complex_quantity:nnn #1#2#3 + { + \bool_lazy_or:nnTF + { \tl_if_blank_p:n {#1} } + { \tl_if_blank_p:n {#2} } + { + \msg_error:nnnn { siunitx } { invalid-polar-form } + {#1} {#2} + } + { \@@_quantity:nnn {#1} {#2} {#3} } + } +\cs_new_protected:Npn \@@_quantity:nnn #1#2#3 + { + \bool_if:NTF \l_@@_force_cartesian_bool + { + \exp_args:Ne \siunitx_complex_quantity:nn + { \@@_convert_cartesian:nn {#1} {#2} } + {#3} + } + { + \@@_parse_polar:nn {#1} {#2} + \@@_format_polar:n {#3} + } } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % -% \begin{macro}{\@@_format:n} -% \begin{macro}{\@@_format_auxi:n} -% \begin{macro}{\@@_format_auxii:n} +% \begin{macro}{\@@_format_cartesian:n} +% \begin{macro}{\@@_format_cartesian_auxi:n} +% \begin{macro}{\@@_format_cartesian_auxii:n} % \begin{macro}{\@@_drop_exponent:nnnnnnn} % \begin{macro}{\@@_format_sign:nnnnnnn} % \begin{macro}{\@@_extract_exponent:nw} @@ -606,18 +785,18 @@ % \begin{macro}[EXP]{\@@_format_bracket:n} % We start here checking that there is something to do. % \begin{macrocode} -\cs_new_protected:Npn \@@_format:n #1 +\cs_new_protected:Npn \@@_format_cartesian:n #1 { \bool_lazy_and:nnF { \tl_if_empty_p:N \l_@@_real_tl } { \tl_if_empty_p:N \l_@@_img_tl } - { \@@_format_auxi:n {#1} } + { \@@_format_cartesian_auxi:n {#1} } } % \end{macrocode} % We split based on whether the number has a complex part at all, % then print the result. % \begin{macrocode} -\cs_new_protected:Npn \@@_format_auxi:n #1 +\cs_new_protected:Npn \@@_format_cartesian_auxi:n #1 { \tl_clear:N \l_@@_tmp_tl \tl_if_empty:NTF \l_@@_img_tl @@ -626,7 +805,7 @@ \tl_set:Nx \l_@@_tmp_tl { \siunitx_number_output:N \l_@@_real_tl } } - { \@@_format_auxii:n {#1} } + { \@@_format_cartesian_auxii:n {#1} } \tl_if_blank:nTF {#1} { \siunitx_print_number:V \l_@@_tmp_tl } { \siunitx_quantity_print:VV \l_@@_tmp_tl \l_@@_unit_tl } @@ -636,9 +815,9 @@ % need to process both and do some massaging, then it's just a question % of reassembly with the right parts in the right places. % \begin{macrocode} -\cs_new_protected:Npn \@@_format_auxii:n #1 +\cs_new_protected:Npn \@@_format_cartesian_auxii:n #1 { - \@@_format_units:n {#1} + \@@_format_cartesian_units:n {#1} \tl_if_empty:NF \l_@@_real_tl { \exp_after:wN \@@_drop_exponent:nnnnnnn \l_@@_real_tl } \exp_after:wN \@@_format_sign:nnnnnnn \l_@@_img_tl @@ -744,12 +923,12 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_format_units:n} +% \begin{macro}{\@@_format_cartesian_units:n} % \begin{macro} % { -% \@@_format_combine-exponent:n , -% \@@_format_extract-exponent:n , -% \@@_format_input:n +% \@@_format_cartesian_combine-exponent:n , +% \@@_format_cartesian_extract-exponent:n , +% \@@_format_cartesian_input:n % } % \begin{macro}{\@@_format_extract-exponent:N} % \begin{macro}[EXP]{\@@_extract_exp:nnnnnnn} @@ -759,7 +938,7 @@ % the flow is then much the same as in \pkg{siunitx-compound}. We only % have to watch the fact there are two numbers to format. % \begin{macrocode} -\cs_new_protected:Npn \@@_format_units:n #1 +\cs_new_protected:Npn \@@_format_cartesian_units:n #1 { \tl_if_blank:nTF {#1} { @@ -767,10 +946,11 @@ \siunitx_number_process:NN \l_@@_img_tl \l_@@_img_tl } { - \use:c { @@_format_ \l_siunitx_quantity_prefix_mode_tl :n } {#1} + \use:c + { @@_format_cartesian_ \l_siunitx_quantity_prefix_mode_tl :n } {#1} } } -\cs_new_protected:cpn { @@_format_combine-exponent:n } #1 +\cs_new_protected:cpn { @@_format_cartesian_combine-exponent:n } #1 { \tl_if_empty:NF \l_@@_real_tl { \siunitx_number_process:NN \l_@@_real_tl \l_@@_real_tl } @@ -782,7 +962,7 @@ \siunitx_unit_format_combine_exponent:nnN {#1} \l_@@_tmp_fp \l_@@_unit_tl } -\cs_new_protected:cpx { @@_format_extract-exponent:n } #1 +\cs_new_protected:cpx { @@_format_cartesian_extract-exponent:n } #1 { \exp_not:N \siunitx_unit_format_extract_prefixes:nNN {#1} \exp_not:N \l_@@_unit_tl \exp_not:N \l_@@_tmp_fp @@ -794,18 +974,18 @@ \exp_not:N \l_@@_real_tl } } +\cs_new_protected:Npn \@@_format_cartesian_input:n #1 + { + \siunitx_number_process:NN \l_@@_real_tl \l_@@_real_tl + \siunitx_number_process:NN \l_@@_img_tl \l_@@_img_tl + \siunitx_unit_format:nN {#1} \l_@@_unit_tl + } \cs_new_protected:cpn { @@_format_extract-exponent:N } #1 { \tl_set:Nx #1 { \siunitx_number_adjust_exponent:Nn #1 \l_@@_tmp_fp } \siunitx_number_process:NN #1 #1 } -\cs_new_protected:Npn \@@_format_input:n #1 - { - \siunitx_number_process:NN \l_@@_real_tl \l_@@_real_tl - \siunitx_number_process:NN \l_@@_img_tl \l_@@_img_tl - \siunitx_unit_format:nN {#1} \l_@@_unit_tl - } \cs_new:Npn \@@_extract_exp:nnnnnnn #1#2#3#4#5#6#7 { #6#7 } \cs_new_protected:Npn \@@_drop_exp:N #1 { \exp_after:wN \@@_drop_exp:nnnnnnnN #1 #1 } @@ -819,14 +999,196 @@ % \end{macro} % \end{macro} % +% \begin{macro} +% { +% \@@_format_polar:n , +% \@@_format_combine-exponent:n , +% \@@_format_extract-exponent:n , +% \@@_format_polar_input:n +% } +% We see similar ideas here to the Cartesian versions, but with only +% the magnitude to adjust, things are rather simpler in the exponent +% manipulations. +% \begin{macrocode} +\cs_new_protected:Npn \@@_format_polar:n #1 + { + \tl_if_blank:nTF {#1} + { \siunitx_number_process:NN \l_@@_mag_tl \l_@@_mag_tl } + { + \use:c + { @@_format_polar_ \l_siunitx_quantity_prefix_mode_tl :n } {#1} + } + \tl_set:Nx \l_@@_tmp_tl + { + \siunitx_number_output:N \l_@@_mag_tl + \exp_not:V \l_@@_symbol_angle_tl + \mathord % TEMP + \exp_not:V \l_@@_angle_tl + } + \siunitx_print_number:V \l_@@_tmp_tl + \bool_if:NT \l_@@_polar_degree_bool + { + \exp_args:NV \siunitx_unit_format:nN \l_@@_symbol_degree_tl \l_@@_tmp_tl + \nobreak + \siunitx_print_unit:V \l_@@_tmp_tl + } + \siunitx_quantity_print:nV { } \l_@@_unit_tl + } +\cs_new_protected:cpn { @@_format_polar_combine-exponent:n } #1 + { + \siunitx_number_process:NN \l_@@_mag_tl \l_@@_mag_tl + \fp_set:Nn \l_@@_tmp_fp + { \exp_after:wN \@@_extract_exp:nnnnnnn \l_@@_mag_tl } + \@@_drop_exp:N \l_@@_mag_tl + \siunitx_unit_format_combine_exponent:nnN {#1} + \l_@@_tmp_fp \l_@@_unit_tl + } +\cs_new_protected:cpx { @@_format_polar_extract-exponent:n } #1 + { + \exp_not:N \siunitx_unit_format_extract_prefixes:nNN {#1} + \exp_not:N \l_@@_unit_tl \exp_not:N \l_@@_tmp_fp + \exp_not:c { @@_format_extract-exponent:N } + \exp_not:N \l_@@_mag_tl + } +\cs_new_protected:Npn \@@_format_polar_input:n #1 + { + \siunitx_number_process:NN \l_@@_mag_tl \l_@@_mag_tl + \siunitx_unit_format:nN {#1} \l_@@_unit_tl + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Conversion} +% +% \begin{macro}[EXP] +% {\@@_convert_cartesian:nn, \@@_convert_cartesian_aux:nn} +% \begin{macro}[EXP]{\@@_convert_cartesian_aux:w} +% Conversion to Cartesian form is easy as we have two inputs and need to +% do no parsing here at all. +% \begin{macrocode} +\cs_new:Npn \@@_convert_cartesian:nn #1#2 + { + \exp_args:Nee \@@_convert_cartesian_aux:nn + { + \fp_to_tl:n + { (#1) * cos \bool_if:NT \l_@@_polar_degree_bool { d } (#2) } + } + { + \fp_to_tl:n + { (#1) * sin \bool_if:NT \l_@@_polar_degree_bool { d } (#2) } + } + } +\cs_new:Npn \@@_convert_cartesian_aux:nn #1#2 + { + \@@_convert_cartesian_aux:w #1 e e \q_mark #2 e e \q_stop + } +\cs_new:Npn \@@_convert_cartesian_aux:w + #1 e #2 e #3 \q_mark #4 e #5 e #6 \q_stop + { + \fp_compare:nNnF {#1} = \c_zero_fp + {#1} + \fp_compare:nNnF {#4} = \c_zero_fp + { + \fp_compare:nNnF {#4} < \c_zero_fp { + } + #4 i + } + \tl_if_blank:nF {#2} + { e #2 } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_convert_polar:n} +% \begin{macro}[EXP]{\@@_convert_polar_auxi:w} +% \begin{macro}[EXP]{\@@_convert_polar_auxii:nw} +% \begin{macro}[EXP]{\@@_convert_polar_auxiii:nnw} +% \begin{macro}[EXP]{\@@_convert_polar_auxiv:nnw} +% \begin{macro}[EXP]{\@@_convert_polar_auxv:nnw} +% \begin{macro}[EXP]{\@@_convert_polar_auxvi:nnn} +% \begin{macro}[EXP]{\@@_convert_polar_auxvii:nnn} +% \begin{macro}[EXP]{\@@_convert_polar_auxviii:nn} +% A simplified parser for complex numbers which works by expansion, +% then converts to polar form. +% \begin{macrocode} +\cs_new:Npn \@@_convert_polar:n #1 + { \@@_convert_polar_auxi:w #1 e e \q_stop } +\cs_new:Npn \@@_convert_polar_auxi:w #1 e #2 e #3 \q_stop + { \@@_convert_polar_auxii:nw {#2} #1 \q_stop } +\cs_new:Npn \@@_convert_polar_auxii:nw #1#2#3 \q_stop + { + \bool_lazy_or:nnTF + { \str_if_eq_p:nn {#2} { i } } + { \str_if_eq_p:nn {#2#3} { +i } } + { \@@_convert_polar_auxvi:nnn { } { 1 } {#1} } + { + \str_if_eq:nnTF {#2#3} { -i } + { \@@_convert_polar_auxvi:nnn { } { -1 } {#1} } + { \@@_convert_polar_auxiii:nnw {#1} {#2} #3 + + \q_stop } + } + } +\cs_new:Npn \@@_convert_polar_auxiii:nnw #1#2#3 + #4 + #5 \q_stop + { + \tl_if_blank:nTF {#4} + { \@@_convert_polar_auxiv:nnw {#1} {#2} #3 - - \q_stop } + { + \str_if_eq:nnTF {#4} { i } + { \@@_convert_polar_auxvi:nnn {#2#3} { 1 } {#1} } + { \@@_convert_polar_auxv:nnw {#2#3} {#1} #4 i \q_nil i \q_stop } + } + } +\cs_new:Npn \@@_convert_polar_auxiv:nnw #1#2#3 - #4 - #5 \q_stop + { + \tl_if_blank:nTF {#4} + { \@@_convert_polar_auxv:nnw { } {#1} #2#3 i \q_nil i \q_stop } + { + \str_if_eq:nnTF {#4} { i } + { \@@_convert_polar_auxvi:nnn { } { -1 } {#1} } + { \@@_convert_polar_auxv:nnw {#2#3} {#1} -#4 i \q_nil i \q_stop } + } + } +\cs_new:Npn \@@_convert_polar_auxv:nnw #1#2#3 i #4 i #5 \q_stop + { + \quark_if_nil:nTF {#4} + { { #3 \tl_if_blank:nF {#2} { e#2 } } { 0 } } + { \@@_convert_polar_auxvi:nnn {#1} {#3} {#2} } + } +\cs_new:Npn \@@_convert_polar_auxvi:nnn #1#2#3 + { + \exp_args:Neee \@@_convert_polar_auxvii:nnn + { \tl_if_blank:nTF {#1} { 0 } {#1} } + { \tl_if_blank:nTF {#2} { 0 } {#2} } + { \tl_if_blank:nF {#3} { e#3 } } + } +\cs_new:Npn \@@_convert_polar_auxvii:nnn #1#2#3 + { + \exp_args:Nee \@@_format_polar_auxviii:nn + { \fp_eval:n { sqrt ( (#1#3)^2 + (#2#3)^2 ) } } + { + \fp_eval:n + { atan \bool_if:NT \l_@@_polar_degree_bool { d } (#2 , #1) } + } + } +\cs_new:Npn \@@_format_polar_auxviii:nn #1#2 { {#1} {#2} } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Messages} % % \begin{macrocode} -\msg_new:nnnn { siunitx } { invalid-complex-number } - { Invalid~complex-number~'#1'. } +\msg_new:nnnn { siunitx } { invalid-polar-form } + { Invalid~polar~form~"#1:#2". } { - The~input~'#1'~could~not~be~parsed~as~a~complex|number~following~the~ - format~defined~in~module~documentation. + Complex~numbers~in~polar~form~must~have~both~a~magnitude~and~and~ + angle. } % \end{macrocode} % @@ -838,7 +1200,11 @@ % \begin{macrocode} \keys_set:nn { siunitx } { + complex-angle-unit = degrees , + complex-mode = input , complex-root-position = after-number , + complex-symbol-angle = \angle , + complex-symbol-degree = \degree , input-complex-root = ij , output-complex-root = \mathrm { i } } diff --git a/macros/latex/contrib/siunitx/siunitx-emulation.dtx b/macros/latex/contrib/siunitx/siunitx-emulation.dtx index aab7d478f2..1b96dd2b9a 100644 --- a/macros/latex/contrib/siunitx/siunitx-emulation.dtx +++ b/macros/latex/contrib/siunitx/siunitx-emulation.dtx @@ -82,11 +82,6 @@ % % Some messages. % \begin{macrocode} -\msg_new:nnn { siunitx } { option-deprecated } - { - Option~"#1"~has~been~deprecated~in~this~release.\\ \\ - Use~"#2"~as~a~replacement. - } \msg_new:nnn { siunitx } { option-removed } { Option~"#1"~has~been~removed~in~this~release. } % \end{macrocode} @@ -97,13 +92,17 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_option_deprecated:nn #1#2 { - \msg_info:nnnn { siunitx } { option-deprecated } {#1} {#2} + \@@_deprecated_info:nn {#1} {#2} \keys_set:nn { siunitx } {#2} } \cs_new_protected:Npn \@@_option_deprecated:nnn #1#2#3 { - \msg_info:nnnn { siunitx } { option-deprecated } {#1} {#2} - \keys_set:nn { siunitx } { #2 = #3 } + \str_if_eq:nnTF {#3} { true } + { \@@_option_deprecated:nn {#1} {#2} } + { + \@@_deprecated_info:nn {#1} { #2 ~=~ #3 } + \keys_set:nn { siunitx } { #2 = #3 } + } } \cs_generate_variant:Nn \@@_option_deprecated:nnn { nnV } % \end{macrocode} @@ -699,18 +698,6 @@ } , literal-superscript-as-power .code:n = { \@@_option_removed:V \l_keys_key_tl } , - per-mode / reciprocal .code:n = - { - \@@_option_deprecated:nn - { per-mode~=~reciprocal } - { per-mode~=~power } - } , - per-mode / reciprocal-positive-first .code:n = - { - \@@_option_deprecated:nn - { per-mode~=~reciprocal-positive-first } - { per-mode~=~power-positive-first } - } , power-font .code:n = { \@@_option_removed:V \l_keys_key_tl } , qualifier-mode / brackets .code:n = @@ -737,6 +724,38 @@ } % \end{macrocode} % +% The deprecated settings for |per-mode| have to be handled manually as +% |per-mode| is no longer a choice. +% \begin{macrocode} +\keys_define:nn { siunitx } + { + display-per-mode / reciprocal .code:n = + { + \@@_option_deprecated:nn + { per-mode~=~reciprocal } + { per-mode~=~power } + } , + inline-per-mode / reciprocal .code:n = + { + \@@_option_deprecated:nn + { per-mode~=~reciprocal } + { per-mode~=~power } + } , + display-per-mode / reciprocal-positive-first .code:n = + { + \@@_option_deprecated:nn + { per-mode~=~reciprocal-positive-first } + { per-mode~=~power-positive-first } + } , + inline-per-mode / reciprocal-positive-first .code:n = + { + \@@_option_deprecated:nn + { per-mode~=~reciprocal-positive-first } + { per-mode~=~power-positive-first } + } + } +% \end{macrocode} +% % \subsection{Quantity units} % % \begin{macrocode} @@ -856,10 +875,11 @@ % \begin{macro}{\si} % A straight copy of \cs{unit}. % \begin{macrocode} -\NewDocumentCommand \si { O { } m } +\NewDocumentCommand \si { O { } > { \TrimSpaces } m } { \mode_leave_vertical: \group_begin: + \siunitx_unit_options_apply:n {#2} \keys_set:nn { siunitx } {#1} \siunitx_unit_format:nN {#2} \l_@@_tmp_tl \siunitx_print_unit:V \l_@@_tmp_tl @@ -871,10 +891,11 @@ % \begin{macro}{\SI} % Almost the same as \cs{qty}, but with the addition pre-unit. % \begin{macrocode} -\NewDocumentCommand \SI { O { } m o m } +\NewDocumentCommand \SI { O { } m o > { \TrimSpaces } m } { \mode_leave_vertical: \group_begin: + \siunitx_unit_options_apply:n {#4} \keys_set:nn { siunitx } {#1} \IfNoValueF {#3} { diff --git a/macros/latex/contrib/siunitx/siunitx-locale.dtx b/macros/latex/contrib/siunitx/siunitx-locale.dtx index 36c83e034f..cbf3ec14a0 100644 --- a/macros/latex/contrib/siunitx/siunitx-locale.dtx +++ b/macros/latex/contrib/siunitx/siunitx-locale.dtx @@ -142,21 +142,24 @@ % % \subsection{Localisation} % -% Localisation makes use of the \pkg{translator} package. This only happens +% Localisation makes use of the \pkg{translations} package. This only happens % if it is available, and is transparent to the user. % \begin{macrocode} \file_if_exist:nT { translations.sty } { \RequirePackage { translations } - \DeclareTranslation { Catalan } { and } { i } - \DeclareTranslation { Slovene } { and } { in } - \DeclareTranslation { Catalan } { to~(numerical~range) } { a } - \DeclareTranslation { English } { to~(numerical~range) } { to } - \DeclareTranslation { French } { to~(numerical~range) } { à } - \DeclareTranslation { German } { to~(numerical~range) } { bis } - \DeclareTranslation { Polish } { to~(numerical~range) } { do } - \DeclareTranslation { Slovene } { to~(numerical~range) } { do } - \DeclareTranslation { Spanish } { to~(numerical~range) } { a } + \DeclareTranslation { Catalan } { and } { i } + \DeclareTranslation { Slovene } { and } { in } + \DeclareTranslation { Portuguese } { and } { e } + \DeclareTranslation { Catalan } { to~(numerical~range) } { a } + \DeclareTranslation { English } { to~(numerical~range) } { to } + \DeclareTranslation { French } { to~(numerical~range) } { à } + \DeclareTranslation { German } { to~(numerical~range) } { bis } + \DeclareTranslation { Polish } { to~(numerical~range) } { do } + \DeclareTranslation { Slovene } { to~(numerical~range) } { do } + \DeclareTranslation { Spanish } { to~(numerical~range) } { a } + \DeclareTranslation { Brazilian } { to~(numerical~range) } { a } + \DeclareTranslation { Portuguese } { to~(numerical~range) } { a } \keys_set:nn { siunitx } { list-final-separator = diff --git a/macros/latex/contrib/siunitx/siunitx-number.dtx b/macros/latex/contrib/siunitx/siunitx-number.dtx index 4f3708e706..f64fb85192 100644 --- a/macros/latex/contrib/siunitx/siunitx-number.dtx +++ b/macros/latex/contrib/siunitx/siunitx-number.dtx @@ -100,7 +100,14 @@ % Valid uncertainty \meta{identifiers} currently are % \begin{itemize} % \item[\texttt{S}] A single symmetrical uncertainty (\foreign{e.g.}~a -% statistical standard uncertainty) +% statistical standard uncertainty). The data item here is a single +% value representing the uncertainty in the least-significant digits +% \item[\texttt{A}] A single unsymmetrical uncertainty. The data item here +% contains two brace groups, each using the same least-significant digit +% approach as the \texttt{S} type. The positive component is given first +% and the negative second, and neither has a sign. +% \item A combination of \texttt{S} and \texttt{A} entries, with one data +% item per entry. These are then iterated over to be output in order. % \end{itemize} % If a decimal marker should be explicitly recorded as present for a value % with no decimal digits, the \meta{decimal} part should contain @@ -301,22 +308,42 @@ % \end{syntax} % \end{function} % +% \begin{function} +% {digit-group-size, digit-group-first-size, digit-group-other-size} +% \begin{syntax} +% |digit-group-number| = \meta{integer} +% \end{syntax} +% Sets the size of the block (the number of digits) used when grouping +% digits. The option |digit-group-first-size| applies to the first grouping, +% \foreign{i.e.}~immediately next to the decimal marker, while +% |digit-group-other-size| applies to all other groups. Both can be set +% using |digit-group-size|. The standard setting for both options is $3$. +% \end{function} +% % \begin{function}{group-digits} % \begin{syntax} % |group-digits| = |all|\verb"|"|decimal|\verb"|"|integer|\verb"|"|none| % \end{syntax} +% Choice to specify whether digits in a number are grouped. The option |none| +% entirely disables this, while |all| means that both the integer and decimal +% parts are grouped. The settings |integer| and |decimal| activate grouping +% for the relevant part only. The standard setting is |all|. % \end{function} % % \begin{function}{group-minimum-digits} % \begin{syntax} % |group-minimum-digits| = \meta{value} % \end{syntax} +% The number of digits that must be present in a numerical part (integer or +% decimal) before digit grouping is attempted. The standard setting is $4$. % \end{function} % % \begin{function}{group-separator} % \begin{syntax} % |group-separator| = \meta{symbol} % \end{syntax} +% Sets the symbol inserted between groups of digits. The standard setting is +% a thin space (\cs{,}). % \end{function} % % \begin{function}{input-close-uncertainty} @@ -443,48 +470,96 @@ % \begin{syntax} % |retain-explicit-plus| = |true|\verb"|"|false| % \end{syntax} +% Switch which determines if an explicit |+| is retained as a sign when +% parsing. The standard setting is |false|. % \end{function} % % \begin{function}{retain-explicit-decimal-marker} % \begin{syntax} % |retain-explicit-decimal-marker| = |true|\verb"|"|false| % \end{syntax} +% Switch which determines if an explicit decimal marker is retained when +% parsing a number where there is no decimal part to a number +% (\foreign{i.e.}~whether to differentiate |10| and |10.|). The standard +% setting is |false|. +% \end{function} +% +% \begin{function}{retain-negative-zero} +% \begin{syntax} +% |retain-negative-zero| = |true|\verb"|"|false| +% \end{syntax} +% Switch which determines if a negative sign is retained where the value of +% a parsed number is exactly zero. The standard setting is |false|. % \end{function} % % \begin{function}{retain-zero-uncertainty} % \begin{syntax} % |retain-zero-uncertainty| = |true|\verb"|"|false| % \end{syntax} +% Switch which determines if an entirely zero uncertainty part is retained +% on parsing, or whether this is normalised to remove the uncertainty. +% The standard setting is |false|. % \end{function} % % \begin{function}{round-half} % \begin{syntax} % |round-half| = |even|\verb"|"|up| % \end{syntax} +% Choice which determines how values of exactly half are rounded. The setting +% |up| means that the value is always rounded away from zero, whereas the +% setting |even| means that the value will be rounded to the closes even +% number. The standard setting is |up|. % \end{function} % % \begin{function}{round-minimum} % \begin{syntax} % |round-minimum| = \meta{min} % \end{syntax} +% Literal which sets a minimum value below which rounded values will be +% replaced by this value and a |>| or |<|, as appropriate for the sign of +% the value. The standard setting is empty, \foreign{i.e.}~there is no +% minimum. % \end{function} % % \begin{function}{round-mode} % \begin{syntax} % |round-mode| = |figures|\verb"|"|none|\verb"|"|places|\verb"|"|uncertainty| % \end{syntax} +% Choice which specifies the rounding approach used for numbers. The choice +% |figures| means that values are rounding to the number of significant +% figures specified by |round-precision|. The setting |places| rounds to +% |round-precision| interpreted as a number of decimal places: this may be +% negative (rounding to an integer). The setting |none| disables rounding. +% The setting |uncertainty| first rounds the uncertainty to the number of +% significant figures specified by |round-precision|, then rounds the main +% value such that its accuracy is correctly specified by this updated +% uncertainty. The standard setting is |none|. % \end{function} % % \begin{function}{round-pad} % \begin{syntax} % |round-pad| = |true|\verb"|"|false| % \end{syntax} +% Switch which specifies if values should be padded to the required number +% length when rounding to a number of decimal places. The standard setting is +% |true|. % \end{function} % % \begin{function}{round-precision} % \begin{syntax} % |round-precision| = \meta{precision} % \end{syntax} +% Integer specifying the number of digits used as a target when rounding: +% this may be interpreted as decimal places or significant figures, +% depending on active |round-mode|. The standard setting is $2$. +% \end{function} +% +% \begin{function}{round-zero-positive} +% \begin{syntax} +% |round-zero-positive| = |true|\verb"|"|false| +% \end{syntax} +% Switch to control whether a value rounded to zero is regarded as a positive +% number if the input was negative. The standard setting is |true|. % \end{function} % % \begin{function}{tight-spacing} @@ -493,16 +568,74 @@ % \end{syntax} % \end{function} % +% \begin{function}{uncertainty-descriptor-mode} +% \begin{syntax} +% |uncertainty-descriptor| = |bracket|\verb"|"|bracket-separator|\verb"|"|separator|\verb"|"|subscript| +% \end{syntax} +% Selects how uncertainty descriptors are formatted: a choice from the +% options |bracket|, |text| and |subscript|. The option |bracket| wraps the +% descriptor in parenthesis, |bracket-separator| does the same but also +% includes a separator between the uncertainty and opening bracket, +% |separator| places the descriptor after the uncertainty and a separator, +% and |subscript| formats the descriptor as a subscript. The +% standard setting is |bracket-separator|. +% \end{function} +% +% \begin{function}{uncertainty-descriptor-separator} +% \begin{syntax} +% |uncertainty-descriptor-separator| = \meta{separator} +% \end{syntax} +% Separateor inserted between the uncertainty and descriptor when one is +% required by |uncertainty-separator-mode|. The standard setting is +% \verb*|\ |. +% \end{function} +% +% \begin{function}{uncertainty-descriptors} +% \begin{syntax} +% |uncertainty-descriptors| = \meta{clist} +% \end{syntax} +% Stores the list of descriptors used when there are multiple uncertainty +% components given. This is not used when there is only a single uncertainty +% component present. The standard setting is |empty|. +% \end{function} +% % \begin{function}{uncertainty-mode} % \begin{syntax} % |uncertainty-mode| = |compact|\verb"|"|compact-marker|\verb"|"|full|\verb"|"|separate| % \end{syntax} +% Switch to determine how single symmetrical uncertainties are formatted. +% When this is set to |separate|, the uncertainty is printed as an entirely +% separate number preceded by \cs{pm}. Other settings all place the +% uncertainty in parentheses directly attached to the main value. The +% standard setting of |compact| prints digits of uncertainty in the +% least-significant digits. It does \emph{not} print a decimal marker if the +% uncertainty crosses the decimal. The setting |full| prints the full value +% of the uncertainty. The setting |compact-marker| is available to print in the +% |compact| style except where the uncertainty crosses the decimal, in which case the +% |full| style is used. The standard setting is |compact|. % \end{function} % % \begin{function}{uncertainty-separator} % \begin{syntax} % |uncertainty-separator| = \meta{separator} % \end{syntax} +% Stores the separator used between the main value and uncertainty when using +% the |compact| or |compact-marker| style setting for |uncertainty-mode|. +% \end{function} +% +% \begin{function}{zero-decimal-as-symbol} +% \begin{syntax} +% |zero-decimal-as-symbol| = |true|\verb"|"|false| +% \end{syntax} +% Switch to determine if an entirely zero decimal part is replaced by a +% symbol. Does not apply if the decimal part is marked as entirely absent. +% \end{function} +% +% \begin{function}{zero-symbol} +% \begin{syntax} +% |zero-symbol| = \meta{symbol} +% \end{syntax} +% Material printed when a zero numerical component is replaced by a symbol. % \end{function} % % \end{documentation} @@ -646,6 +779,7 @@ % \l_@@_input_uncert_sign_tl , % \l_@@_explicit_decimal_bool , % \l_@@_explicit_plus_bool , +% \l_@@_negative_zero_bool , % \l_@@_zero_uncert_bool % } % \begin{macro}[EXP]{\@@_expression:n} @@ -688,6 +822,8 @@ \l_@@_explicit_decimal_bool , retain-explicit-plus .bool_set:N = \l_@@_explicit_plus_bool , + retain-negative-zero .bool_set:N = + \l_@@_negative_zero_bool , retain-zero-uncertainty .bool_set:N = \l_@@_zero_uncert_bool } @@ -753,6 +889,14 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_uncert_tl} +% To allow multiple uncertainties, we want to build this up as possibly +% multiple entries. +% \begin{macrocode} +\tl_new:N \l_@@_uncert_tl +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\l_@@_validate_bool} % Used to set up for validation with no error production. % \begin{macrocode} @@ -825,6 +969,7 @@ { \group_begin: \tl_clear:N \l_@@_parsed_tl + \tl_clear:N \l_@@_uncert_tl \tl_map_inline:Nn \l_@@_input_ignore_tl { \token_if_macro:NT ##1 @@ -858,25 +1003,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_parse_check: { - \tl_if_empty:NF \l_@@_flex_tl + \tl_put_right:NV \l_@@_uncert_tl \l_@@_flex_tl + \tl_if_empty:NF \l_@@_uncert_tl { - \bool_lazy_and:nnTF - { - \tl_if_blank_p:f - { \exp_after:wN \use_iv:nnnn \l_@@_parsed_tl } - } - { - \tl_if_blank_p:f - { \exp_after:wN \use_iv:nnnn \l_@@_flex_tl } - } - { - \tl_set:Nx \l_@@_tmp_tl - { \exp_after:wN \use_i:nnnn \l_@@_flex_tl } - \tl_if_in:NVTF \l_@@_input_uncert_sign_tl - \l_@@_tmp_tl - { \@@_parse_combine_uncert: } - { \tl_clear:N \l_@@_parsed_tl } - } + \tl_if_blank:fTF { \exp_after:wN \use_iv:nnnn \l_@@_parsed_tl } + { \@@_parse_combine_uncert: } { \tl_clear:N \l_@@_parsed_tl } } \tl_if_empty:NTF \l_@@_parsed_tl @@ -893,111 +1024,159 @@ % \end{macro} % % \begin{macro}{\@@_parse_combine_uncert:} -% \begin{macro}{\@@_parse_combine_uncert_auxi:nnnnnnnn} -% \begin{macro} -% { -% \@@_parse_combine_uncert_auxii:nnnnn, -% \@@_parse_combine_uncert_auxii:fnnnn -% } -% \begin{macro} -% { -% \@@_parse_combine_uncert_auxiii:nnnnnn, -% \@@_parse_combine_uncert_auxiii:fnnnnn -% } -% \begin{macro}{\@@_parse_combine_uncert_auxiv:nnnn} -% \begin{macro}[EXP]{\@@_parse_combine_uncert_auxv:w} -% \begin{macro}[EXP]{\@@_parse_combine_uncert_auxvi:w} +% \begin{macro}[EXP]{\@@_parse_combine_uncert:nnnn} +% \begin{macro}[EXP]{\@@_parse_combine_uncert:nn} +% \begin{macro}[EXP]{\@@_parse_combine_uncert_loop:nnnnnnn} +% \begin{macro}[EXP]{\@@_parse_combine_uncert:nnnnnn} +% \begin{macro}[EXP]{\@@_parse_combine_uncert:nnnnnnn} +% \begin{macro}[EXP]{\@@_parse_combine_uncert:nnnnn} +% \begin{macro}[EXP]{\@@_parse_combine_uncert_aux:nnnn} +% \begin{macro}[EXP]{\@@_parse_combine_uncert:N} +% \begin{macro}[EXP]{\@@_parse_combine_uncert:w} +% \begin{macro}[EXP]{\@@_parse_combine_uncert_end:nnn} +% \begin{macro}[EXP]{\@@_parse_combine_uncert_end:nnnn} % Conversion of a second numerical part to an uncertainty needs a bit of % work. The first step is to extract the useful information from the two -% stores: the sign, integer and decimal parts from the real number and the -% integer and decimal parts from the second number. That is done using the -% input stack to avoid lots of assignments. +% stores: the sign, integer and decimal parts from the real number. Then +% set up a loop to deal with each uncertainty to combine. Everything is done +% by expansion to avoid repeated assignments. To allow for the case where +% there is an error, the setup doesn't insert any tokens until the end of +% the loop, which means a bit of work on the stack. % \begin{macrocode} \cs_new_protected:Npn \@@_parse_combine_uncert: { - \exp_after:wN \exp_after:wN \exp_after:wN - \@@_parse_combine_uncert_auxi:nnnnnnnn - \exp_after:wN \l_@@_parsed_tl \l_@@_flex_tl + \tl_set:Nx \l_@@_parsed_tl + { + \exp_after:wN \@@_parse_combine_uncert:nnnn + \l_@@_parsed_tl + } } % \end{macrocode} -% Here, |#4|, |#5| and |#8| are all junk arguments simply there to mop up -% tokens, while |#1| will be recovered later from \cs{l_@@_parsed_tl} so does -% not need to be passed about. The difference in places between the two -% decimal parts is now found: this is done just once to avoid having to -% parse token lists twice. The value is then used to generate a number of -% filler |0| tokens, and these are added to the appropriate part of the -% number. Finally, everything is recombined: the integer part only needs -% a test to avoid an empty main number. +% Here, |#1| and |#2| are not required at this stage, while |#4| is junk. +% Thus |#3| is the only item needed for the rest of the process. After a +% little argument shuffling, the main loop can begin. % \begin{macrocode} -\cs_new_protected:Npn - \@@_parse_combine_uncert_auxi:nnnnnnnn #1#2#3#4#5#6#7#8 +\cs_new:Npn \@@_parse_combine_uncert:nnnn #1#2#3#4 + { + \exp_after:wN \@@_parse_combine_uncert:nn + \exp_after:wN { \l_@@_uncert_tl } {#3} + } +\cs_new:Npn \@@_parse_combine_uncert:nn #1#2 { - \@@_parse_combine_uncert_auxii:fnnnn - { \int_eval:n { \tl_count:n {#3} - \tl_count:n {#7} } } - {#2} {#3} {#6} {#7} + \@@_parse_combine_uncert_loop:nnnnnnn {#2} { } { } + #1 + { \q_recursion_tail } { } { } { } \q_recursion_stop } -\cs_new_protected:Npn - \@@_parse_combine_uncert_auxii:nnnnn #1 +% \end{macrocode} +% Here, |#4| and |#7| are junk arguments simply there to mop up +% tokens, with the exception that |#4| is also used for the end-of-loop +% test. +% \begin{macrocode} +\cs_new:Npn \@@_parse_combine_uncert_loop:nnnnnnn #1#2#3#4#5#6#7 { - \@@_parse_combine_uncert_auxiii:fnnnnn + \quark_if_recursion_tail_stop_do:nn {#4} + { \@@_parse_combine_uncert_end:nnn {#1} {#2} {#3} } + \exp_args:Nf \@@_parse_combine_uncert:nnnnnn + { \int_eval:n { \tl_count:n {#1} - \tl_count:n {#6} } } + {#1} {#2} {#3} {#5} {#6} + } +% \end{macrocode} +% The difference in places between the two decimal parts is now found: this +% is done just once to avoid having to parse token lists twice. The value +% is then used to generate a number of filler |0| tokens, and these are added +% to the appropriate part of the number. +% \begin{macrocode} +\cs_new:Npn \@@_parse_combine_uncert:nnnnnn #1 + { + \exp_args:Nf \@@_parse_combine_uncert:nnnnnnn { \prg_replicate:nn { \int_abs:n {#1} } { 0 } } {#1} } -\cs_generate_variant:Nn \@@_parse_combine_uncert_auxii:nnnnn { f } -\cs_new_protected:Npn - \@@_parse_combine_uncert_auxiii:nnnnnn #1#2#3#4#5#6 +\cs_new:Npn \@@_parse_combine_uncert:nnnnnnn #1#2#3#4#5#6#7 { \int_compare:nNnTF {#2} > 0 { - \@@_parse_combine_uncert_auxiv:nnnn - {#3} {#4} {#5} { #6 #1 } + \@@_parse_combine_uncert:nnnnn + {#3} {#4} {#5} {#6} { #7 #1 } } { - \@@_parse_combine_uncert_auxiv:nnnn - {#3} { #4 #1 } {#5} {#6} + \@@_parse_combine_uncert:nnnnn + { #3 #1 } {#4} {#5} {#6} {#7} } } -\cs_generate_variant:Nn - \@@_parse_combine_uncert_auxiii:nnnnnn { f } -\cs_new_protected:Npn - \@@_parse_combine_uncert_auxiv:nnnn #1#2#3#4 +% \end{macrocode} +% We now ensure that the decimal part is never entirely blank \emph{if} there +% are decimal-part uncertainty digits. There is also a need to handle the +% possibly of an entirely empty uncertainty, where the value is zero and that +% is not being retained. +% \begin{macrocode} +\cs_new:Npn \@@_parse_combine_uncert:nnnnn #1#2#3#4#5 { - \tl_set:Nx \l_@@_parsed_tl + \exp_args:Nee \@@_parse_combine_uncert_aux:nnnn { - { \tl_head:V \l_@@_parsed_tl } - { \exp_not:n {#1} } - { - \bool_lazy_and:nnTF - { \tl_if_blank_p:n {#2} } - { ! \tl_if_blank_p:n {#4} } - { 0 } - { \exp_not:n {#2} } - } - { - \@@_parse_combine_uncert_auxv:w #3#4 - \q_recursion_tail \q_recursion_stop - } + \bool_lazy_and:nnTF + { \tl_if_blank_p:n {#1} } + { ! \tl_if_blank_p:n {#5} } + { 0 } + { \exp_not:n {#1} } + } + { + \@@_parse_combine_uncert:N #4#5 + \q_recursion_tail \q_recursion_stop + } + {#2} + {#3} + } +\cs_new:Npn \@@_parse_combine_uncert_aux:nnnn #1#2#3#4 + { + \exp_args:Neee \@@_parse_combine_uncert_loop:nnnnnnn + { \exp_not:n {#1} } + { + \exp_not:n {#3} + \tl_if_blank:nF {#2} { S } + } + { + \exp_not:n {#4} + \tl_if_blank:nF {#2} { { \exp_not:n {#2} } } } } % \end{macrocode} % A short routine to remove any leading zeros in the uncertainty part, % which are not needed for the compact representation used by the module. % \begin{macrocode} -\cs_new:Npn \@@_parse_combine_uncert_auxv:w #1 +\cs_new:Npn \@@_parse_combine_uncert:N #1 { \quark_if_recursion_tail_stop_do:Nn #1 - { - \bool_if:NT \l_@@_zero_uncert_bool - { { S } { 0 } } - } + { \bool_if:NT \l_@@_zero_uncert_bool { 0 } } \str_if_eq:nnTF {#1} { 0 } - { \@@_parse_combine_uncert_auxv:w } - { \@@_parse_combine_uncert_auxvi:w #1 } + { \@@_parse_combine_uncert:N } + { \@@_parse_combine_uncert:w #1 } } -\cs_new:Npn \@@_parse_combine_uncert_auxvi:w +\cs_new:Npn \@@_parse_combine_uncert:w #1 \q_recursion_tail \q_recursion_stop - { { S } { \exp_not:n {#1} } } + { \exp_not:n {#1} } % \end{macrocode} +% Recover the sign and integer part, then add in the new decimal and the +% uncertainties. +% \begin{macrocode} +\cs_new:Npn \@@_parse_combine_uncert_end:nnn #1#2#3 + { + \exp_after:wN \@@_parse_combine_uncert_end:nnnn + \l_@@_parsed_tl + { \exp_not:n {#1} } + { + \tl_if_blank:nF {#2} + { \exp_not:n { {#2} #3 } } + } + } +\cs_new:Npn \@@_parse_combine_uncert_end:nnnn #1#2#3#4 + { \exp_not:n { {#1} {#2} } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % \end{macro} % \end{macro} % \end{macro} @@ -1155,9 +1334,10 @@ % \end{macro} % % \begin{macro}{\@@_parse_finalise:} -% \begin{macro}{\@@_parse_finalise:nw} -% Combine all of the bits of a number together: both the real and -% imaginary parts contain all of the data. +% \begin{macro}[EXP]{\@@_parse_finalise:nnnn} +% \begin{macro}[EXP]{\@@_parse_finalise:nw} +% Combine all of the bits of a number together, dealing with negative zero +% if required. % \begin{macrocode} \cs_new_protected:Npn \@@_parse_finalise: { @@ -1166,12 +1346,28 @@ \tl_set:Nx \l_@@_parsed_tl { { \exp_not:V \l_@@_comparator_tl } - \exp_not:V \l_@@_parsed_tl + \exp_after:wN \@@_parse_finalise:nnnn \l_@@_parsed_tl \exp_after:wN \@@_parse_finalise:nw \l_@@_exponent_tl \q_stop } } } +\cs_new:Npn \@@_parse_finalise:nnnn #1#2#3#4 + { + \bool_lazy_all:nTF + { + { ! \l_@@_negative_zero_bool } + { \str_if_eq_p:nn {#1} { - } } + { ! \tl_if_blank_p:n {#2#3} } + { + \str_if_eq_p:ee + { \exp_not:n {#2#3} } + { \prg_replicate:nn { \tl_count:n {#2#3} } { 0 } } + } + } + { \exp_not:n { { } {#2} {#3} {#4} } } + { \exp_not:n { {#1} {#2} {#3} {#4} } } + } \cs_new:Npn \@@_parse_finalise:nw #1#2 \q_stop { { \exp_not:n {#1} } @@ -1180,21 +1376,21 @@ % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\@@_parse_loop:} -% \begin{macro}{\@@_parse_loop_first:N} -% \begin{macro}{\@@_parse_loop_main:NNNNN} +% \begin{macro}{\@@_parse_loop_first:NNN} +% \begin{macro}{\@@_parse_loop_main:NNNN} % \begin{macro}{\@@_parse_loop_main_end:NN} -% \begin{macro}{\@@_parse_loop_main_digit:NNNNN} -% \begin{macro}{\@@_parse_loop_main_decimal:NN} -% \begin{macro}{\@@_parse_loop_main_uncert:NNN} +% \begin{macro}{\@@_parse_loop_main_digit:NNNN} +% \begin{macro}{\@@_parse_loop_main_decimal:N} +% \begin{macro}{\@@_parse_loop_main_uncert:NN} % \begin{macro}{\@@_parse_loop_main_sign:NNN} % \begin{macro}{\@@_parse_loop_main_store:NNN} -% \begin{macro}{\@@_parse_loop_after_decimal:NNN} -% \begin{macro}{\@@_parse_loop_root_swap:NNwNN} -% \begin{macro}{\@@_parse_loop_break:wN} +% \begin{macro}{\@@_parse_loop_after_decimal:NN} +% \begin{macro}{\@@_parse_loop_break:w} % At this stage, the partial input \cs{l_@@_arg_tl} will contain any -% mantissa, which may contain an uncertainty or complex part. Parsing this +% mantissa, which may contain one or more uncertainties. Parsing this % and allowing for all of the different formats possible is best done using % a token-by-token approach. However, as at each stage only a subset of % tokens are valid, the approach take is to use a set of semi-dedicated @@ -1229,25 +1425,25 @@ { \bool_if:NTF #2 { \tl_put_right:Nn #1 { { } { } { } } } - { \@@_parse_loop_break:wN \q_recursion_stop } + { \@@_parse_loop_break:w \q_recursion_stop } } \tl_if_in:NnTF \l_@@_input_digit_tl {#3} { - \@@_parse_loop_main:NNNNN - #1 \c_true_bool \c_false_bool #2 #3 + \@@_parse_loop_main:NNNN + #1 \c_true_bool \c_false_bool #3 } { \tl_if_in:NnTF \l_siunitx_number_input_decimal_tl {#3} { \tl_put_right:Nn #1 { { 0 } } - \@@_parse_loop_after_decimal:NNN #1 #2 + \@@_parse_loop_after_decimal:NN #1 } - { \@@_parse_loop_break:wN } + { \@@_parse_loop_break:w } } } % \end{macrocode} % A single function is used to cover the \enquote{main} part of numbers: -% finding real, complex or separated uncertainty parts and covering both +% finding the main or separated uncertainty parts and covering both % the integer and decimal components. This works because these elements % share a lot of concepts: a small number of switches can be used to % differentiate between them. To keep the code at least somewhat readable, @@ -1264,37 +1460,33 @@ % there leading to a store-and-switch situation. % \item An open-uncertainty token: switch to the dedicated collector % for uncertainties. -% \item A sign token (if allowed): stop collecting this number and -% restart collection for the second part. +% \item A sign token: stop collecting this number and +% restart collection for the next part. % \end{itemize} % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_loop_main:NNNNN #1#2#3#4#5 +\cs_new_protected:Npn \@@_parse_loop_main:NNNN #1#2#3#4 { - \quark_if_recursion_tail_stop_do:Nn #5 + \quark_if_recursion_tail_stop_do:Nn #4 { \@@_parse_loop_main_end:NN #1#2 } - \tl_if_in:NnTF \l_@@_input_digit_tl {#5} - { \@@_parse_loop_main_digit:NNNNN #1#2#3#4#5 } + \tl_if_in:NnTF \l_@@_input_digit_tl {#4} + { \@@_parse_loop_main_digit:NNNN #1#2#3#4 } { - \tl_if_in:NnTF \l_siunitx_number_input_decimal_tl {#5} + \tl_if_in:NnTF \l_siunitx_number_input_decimal_tl {#4} { \bool_if:NTF #2 - { \@@_parse_loop_main_decimal:NN #1 #4 } - { \@@_parse_loop_break:wN } + { \@@_parse_loop_main_decimal:N #1 } + { \@@_parse_loop_break:w } } { - \tl_if_in:NnTF \l_@@_input_uncert_open_tl {#5} - { \@@_parse_loop_main_uncert:NNN #1#2 #4 } + \tl_if_in:NnTF \l_@@_input_uncert_open_tl {#4} + { \@@_parse_loop_main_uncert:NN #1 #2 } { - \bool_if:NTF #4 + \tl_if_in:NnTF \l_@@_input_uncert_sign_tl {#4} { - \tl_if_in:NnTF \l_siunitx_number_input_sign_tl {#5} - { - \@@_parse_loop_main_sign:NNN - #1#2 #5 - } - { \@@_parse_loop_break:wN } + \@@_parse_loop_main_sign:NNN + #1 #2 #4 } - { \@@_parse_loop_break:wN } + { \@@_parse_loop_break:w } } } } @@ -1333,25 +1525,25 @@ % that is handled using a combination of a switch and a string test. Other % than that, the situation here is simple: store the input and loop. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_loop_main_digit:NNNNN #1#2#3#4#5 +\cs_new_protected:Npn \@@_parse_loop_main_digit:NNNN #1#2#3#4 { \bool_lazy_or:nnTF - {#3} { ! \str_if_eq_p:nn {#5} { 0 } } + {#3} { ! \str_if_eq_p:nn {#4} { 0 } } { - \tl_put_right:Nn \l_@@_partial_tl {#5} - \@@_parse_loop_main:NNNNN #1 #2 \c_true_bool #4 + \tl_put_right:Nn \l_@@_partial_tl {#4} + \@@_parse_loop_main:NNNN #1 #2 \c_true_bool } - { \@@_parse_loop_main:NNNNN #1 #2 \c_false_bool #4 } + { \@@_parse_loop_main:NNNN #1 #2 \c_false_bool } } % \end{macrocode} % When a decimal marker was found, move the integer part to the % store and then go back to the loop with the flags set correctly. % There is the case of non-significant zeros to cover before that, of course. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_loop_main_decimal:NN #1#2 +\cs_new_protected:Npn \@@_parse_loop_main_decimal:N #1 { \@@_parse_loop_main_store:NNN #1 \c_false_bool \c_false_bool - \@@_parse_loop_after_decimal:NNN #1 #2 + \@@_parse_loop_after_decimal:NN #1 } % \end{macrocode} % Starting an uncertainty part means storing the number to date as in other @@ -1359,10 +1551,11 @@ % uncertainty itself is collected by a dedicated function as it is extremely % restricted. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_loop_main_uncert:NNN #1#2#3 +\cs_new_protected:Npn \@@_parse_loop_main_uncert:NN #1#2 { \@@_parse_loop_main_store:NNN #1 #2 \c_false_bool - \@@_parse_uncert:NN #1 + \tl_clear:N \l_@@_uncert_tl + \@@_parse_uncert:N } % \end{macrocode} % If a sign is found, terminate the current number, store the sign as the @@ -1372,6 +1565,7 @@ \cs_new_protected:Npn \@@_parse_loop_main_sign:NNN #1#2#3 { \@@_parse_loop_main_store:NNN #1 #2 \c_true_bool + \tl_put_right:NV \l_@@_uncert_tl \l_@@_flex_tl \tl_set:Nn \l_@@_flex_tl { {#3} } \@@_parse_loop_first:NNN \l_@@_flex_tl \c_false_bool @@ -1384,11 +1578,13 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_parse_loop_main_store:NNN #1#2#3 { - \tl_if_empty:NT \l_@@_partial_tl - { \tl_set:Nn \l_@@_partial_tl { 0 } } \tl_put_right:Nx #1 { - { \exp_not:V \l_@@_partial_tl } + { + \tl_if_empty:NTF \l_@@_partial_tl + { 0 } + { \exp_not:V \l_@@_partial_tl } + } \bool_if:NT #2 { { } } \bool_if:NT #3 { { } } } @@ -1400,23 +1596,23 @@ % an empty integer part first then either simply hands off or looks for % a digit. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_loop_after_decimal:NNN #1#2#3 +\cs_new_protected:Npn \@@_parse_loop_after_decimal:NN #1#2 { \tl_if_blank:fTF { \exp_after:wN \use_none:n #1 } { - \quark_if_recursion_tail_stop_do:Nn #3 - { \@@_parse_loop_break:wN \q_recursion_stop } + \quark_if_recursion_tail_stop_do:Nn #2 + { \@@_parse_loop_break:w \q_recursion_stop } \tl_if_in:NnTF \l_@@_input_digit_tl {#1} { - \tl_put_right:Nn \l_@@_partial_tl {#3} - \@@_parse_loop_main:NNNNN - #1 \c_false_bool \c_true_bool #2 + \tl_put_right:Nn \l_@@_partial_tl {#2} + \@@_parse_loop_main:NNNN + #1 \c_false_bool \c_true_bool } - { \@@_parse_loop_break:wN } + { \@@_parse_loop_break:w } } { - \@@_parse_loop_main:NNNNN - #1 \c_false_bool \c_true_bool #2 #3 + \@@_parse_loop_main:NNNN + #1 \c_false_bool \c_true_bool #2 } } % \end{macrocode} @@ -1424,7 +1620,7 @@ % number and clear the storage areas as a signal for the next part of the % code. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_loop_break:wN +\cs_new_protected:Npn \@@_parse_loop_break:w #1 \q_recursion_stop { \tl_clear:N \l_@@_flex_tl @@ -1442,7 +1638,6 @@ % \end{macro} % \end{macro} % \end{macro} -% \end{macro} % % \begin{macro}{\@@_parse_sign:} % \begin{macro}{\@@_parse_sign_aux:Nw} @@ -1476,11 +1671,11 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_parse_uncert:NN} -% \begin{macro}{\@@_parse_uncert:NNNN} -% \begin{macro}{\@@_parse_uncert_auxi:NN, \@@_parse_uncert_auxii:NN} -% \begin{macro} {\@@_parse_uncert_auxii:N, \@@_parse_uncert_marker:N} -% \begin{macro}{\@@_parse_uncert_extend:nnnN} +% \begin{macro}{\@@_parse_uncert:N} +% \begin{macro}{\@@_parse_uncert:NNN} +% \begin{macro}{\@@_parse_uncert_auxi:N, \@@_parse_uncert_auxii:N} +% \begin{macro} {\@@_parse_uncert_auxii:, \@@_parse_uncert_marker:} +% \begin{macro}{\@@_parse_uncert_extend:nnn} % \begin{macro}{\@@_parse_uncert_after:N} % Parsing a combined uncertainty has a very restricted range of allowed % tokens. A closing uncertainty token in the first place is an error, @@ -1488,84 +1683,72 @@ % which require checking for significant digits. The non-digit function % is separate to make the flow clearer. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_uncert:NN #1#2 +\cs_new_protected:Npn \@@_parse_uncert:N #1 { - \quark_if_recursion_tail_stop_do:Nn #2 - { \@@_parse_loop_break:wN \q_recursion_stop } - \tl_if_in:NnTF \l_@@_input_uncert_close_tl {#2} - { \@@_parse_loop_break:wN } + \quark_if_recursion_tail_stop_do:Nn #1 + { \@@_parse_loop_break:w \q_recursion_stop } + \tl_if_in:NnTF \l_@@_input_uncert_close_tl {#1} + { \@@_parse_loop_break:w } { - \@@_parse_uncert:NNNN - #1 \c_false_bool \@@_parse_uncert_auxi:NN #2 + \@@_parse_uncert:NNN + \c_false_bool \@@_parse_uncert_auxi:N #1 } } % \end{macrocode} % Deal with digits: a simple question of whether they are significant. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_uncert:NNNN #1#2#3#4 +\cs_new_protected:Npn \@@_parse_uncert:NNN #1#2#3 { - \quark_if_recursion_tail_stop_do:Nn #4 - { \@@_parse_loop_break:wN \q_recursion_stop } - \tl_if_in:NnTF \l_@@_input_digit_tl {#4} + \quark_if_recursion_tail_stop_do:Nn #3 + { \@@_parse_loop_break:w \q_recursion_stop } + \tl_if_in:NnTF \l_@@_input_digit_tl {#3} { \bool_lazy_or:nnTF - {#2} { ! \str_if_eq_p:nn {#4} { 0 } } + {#1} { ! \str_if_eq_p:nn {#3} { 0 } } { - \tl_put_right:Nn \l_@@_partial_tl {#4} - \@@_parse_uncert:NNNN #1 \c_true_bool #3 + \tl_put_right:Nn \l_@@_partial_tl {#3} + \@@_parse_uncert:NNN \c_true_bool #2 } - { \@@_parse_uncert:NNNN #1 \c_false_bool #3 } + { \@@_parse_uncert:NNN \c_false_bool #2 } } - { #3 #1#4 } + { #2 #3 } } % \end{macrocode} % For the two auxiliaries, the difference is the handling of a % decimal marker: one may be present, but only exactly one. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_uncert_auxi:NN #1#2 +\cs_new_protected:Npn \@@_parse_uncert_auxi:N #1 { - \tl_if_in:NnTF \l_@@_input_uncert_close_tl {#2} + \tl_if_in:NnTF \l_@@_input_uncert_close_tl {#1} { - \@@_parse_uncert_auxiii:N #1 + \@@_parse_uncert_auxiii: \@@_parse_uncert_after:N } { - \tl_if_in:NnTF \l_siunitx_number_input_decimal_tl {#2} - { \@@_parse_uncert_marker:N #1 } - { \@@_parse_loop_break:wN } + \tl_if_in:NnTF \l_siunitx_number_input_decimal_tl {#1} + { \@@_parse_uncert_marker: } + { \@@_parse_loop_break:w } } } -\cs_new_protected:Npn \@@_parse_uncert_auxii:NN #1#2 +\cs_new_protected:Npn \@@_parse_uncert_auxii:N #1 { - \tl_if_in:NnTF \l_@@_input_uncert_close_tl {#2} + \tl_if_in:NnTF \l_@@_input_uncert_close_tl {#1} { - \@@_parse_uncert_auxiii:N #1 + \@@_parse_uncert_auxiii: \@@_parse_uncert_after:N } - { \@@_parse_loop_break:wN } + { \@@_parse_loop_break:w } } % \end{macrocode} % Deal with the closing bracket, which might leave us with nothing if there % were no significant digits. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_uncert_auxiii:N #1 +\cs_new_protected:Npn \@@_parse_uncert_auxiii: { - \tl_if_empty:NTF \l_@@_partial_tl - { - \tl_put_right:Nx #1 - { - { - \bool_if:NT \l_@@_zero_uncert_bool - { { S } { 0 } } - } - } - } - { - \tl_set:Nx \l_@@_partial_tl - { { S } { \exp_not:V \l_@@_partial_tl } } - \@@_parse_loop_main_store:NNN #1 - \c_false_bool \c_false_bool - } + \bool_lazy_and:nnT + { \l_@@_zero_uncert_bool } + { \tl_if_empty_p:N \l_@@_partial_tl } + { \tl_set:Nn \l_@@_partial_tl { 0 } } } % \end{macrocode} % Handling a decimal marker in the uncertainty is a bit tricky: we need to make @@ -1578,50 +1761,76 @@ % digits then a closing marker. So we can use that as a length: if it's % too long we can stop. % \begin{macrocode} -\cs_new_protected:Npn \@@_parse_uncert_marker:N #1 - { \exp_after:wN \@@_parse_uncert_marker:nnnN #1 #1 } -\cs_new_protected:Npn \@@_parse_uncert_marker:nnnN #1#2#3#4 +\cs_new_protected:Npn \@@_parse_uncert_marker: + { + \exp_after:wN \@@_parse_uncert_marker:nnn + \l_@@_parsed_tl + } +\cs_new_protected:Npn \@@_parse_uncert_marker:nnn #1#2#3 { \int_compare:nNnTF { \tl_count:N \l_@@_partial_tl } > { \tl_count:n {#2} } - { \@@_parse_loop_break:wN } - { \@@_parse_uncert_marker:nNw {#3} #4 } + { \@@_parse_loop_break:w } + { \@@_parse_uncert_marker:nw {#3} } } -\cs_new_protected:Npn \@@_parse_uncert_marker:nNw - #1#2#3 \q_recursion_tail \q_recursion_stop +\cs_new_protected:Npn \@@_parse_uncert_marker:nw + #1#2 \q_recursion_tail \q_recursion_stop { \int_compare:nNnTF - { \tl_count:n {#3} - 1 } = { \tl_count:n {#1} } + { \tl_count:n {#2} - 1 } = { \tl_count:n {#1} } { \str_if_eq:eeTF - { \exp_not:V \l_@@_partial_tl } + { \exp_not:V \l_@@_uncert_tl } { \prg_replicate:nn { \tl_count:N \l_@@_partial_tl } { 0 } } - { - \@@_parse_uncert:NNNN - #2 \c_false_bool - } - { - \@@_parse_uncert:NNNN - #2 \c_true_bool - } - \@@_parse_uncert_auxii:NN + { \@@_parse_uncert:NNN \c_false_bool } + { \@@_parse_uncert:NNN \c_true_bool } + \@@_parse_uncert_auxii:N } - { \exp_after:wN \@@_parse_uncert_extend:nnnN #2 #2 } - #3 \q_recursion_tail \q_recursion_stop + { \exp_after:wN \@@_parse_uncert_extend:nnn \l_@@_parsed_tl } + #2 \q_recursion_tail \q_recursion_stop } -\cs_new_protected:Npn \@@_parse_uncert_extend:nnnN #1#2#3#4 +\cs_new_protected:Npn \@@_parse_uncert_extend:nnn #1#2#3 { - \tl_set:Nn #4 { {#1} {#2} { #3 0 } } - \@@_parse_uncert:NNNN #4 \c_true_bool - \@@_parse_uncert_auxii:NN + \tl_set:Nn \l_@@_parsed_tl { {#1} {#2} { #3 0 } } + \@@_parse_uncert:NNN \c_true_bool + \@@_parse_uncert_auxii:N } % \end{macrocode} -% No further tokens are allowed after an uncertainty in parenthesis. +% At the end of collection, we can either start another one or be done: +% either way we move the data around. % \begin{macrocode} \cs_new_protected:Npn \@@_parse_uncert_after:N #1 { - \quark_if_recursion_tail_stop:N #1 - \@@_parse_loop_break:wN + \tl_set:Nx \l_@@_uncert_tl + { + \exp_not:V \l_@@_uncert_tl + \tl_if_empty:NF \l_@@_partial_tl + { { \exp_not:V \l_@@_partial_tl } } + } + \tl_clear:N \l_@@_partial_tl + \quark_if_recursion_tail_stop_do:Nn #1 + { + \tl_set:Nx \l_@@_parsed_tl + { + \exp_not:V \l_@@_parsed_tl + { + \tl_if_empty:NF \l_@@_uncert_tl + { + { + \prg_replicate:nn + { \tl_count:N \l_@@_uncert_tl } + { S } + } + \exp_not:V \l_@@_uncert_tl + } + } + } + \tl_clear:N \l_@@_partial_tl + \tl_clear:N \l_@@_uncert_tl + } + \tl_if_in:NnTF \l_@@_input_uncert_open_tl {#1} + { \@@_parse_uncert:N } + { \@@_parse_loop_break:w } } % \end{macrocode} % \end{macro} @@ -1645,7 +1854,8 @@ % \l_@@_round_half_even_bool , % \l_@@_round_mode_tl , % \l_@@_round_pad_bool , -% \l_@@_round_precision_int +% \l_@@_round_precision_int , +% \l_@@_round_positive_bool % } % \begin{macrocode} \keys_define:nn { siunitx } @@ -1679,6 +1889,8 @@ \l_@@_round_pad_bool , round-precision .int_set:N = \l_@@_round_precision_int , + round-zero-positive .bool_set:N = + \l_@@_round_positive_bool } \bool_new:N \l_@@_round_half_even_bool \tl_new:N \l_@@_exponent_mode_tl @@ -2113,8 +2325,12 @@ % \begin{macro}{\@@_digits:NN} % \begin{macro}[EXP]{\@@_digits:nnnnnnn} % \begin{macro}[EXP]{\@@_digits:nn} -% \begin{macro}[EXP]{\@@_digits_uncert:nnn} -% \begin{macro}[EXP]{\@@_digits_uncert_S:nn} +% \begin{macro}[EXP]{\@@_digits_uncert:nnw} +% \begin{macro}[EXP] +% {\@@_digits_uncert_A:nn, \@@_digits_uncert_S:nn, \@@_digits_uncert_aux:nn} +% \begin{macro}[EXP]{\@@_digits_uncert_A:nnn} +% \begin{macro}[EXP]{\@@_digits_uncert:nN} +% \begin{macro}[EXP]{\@@_digits_uncert:nNw} % Forcing a minimum number of digits in each part is quite easy. As % the common case is that we don't do anything here, there is no real need % to optimise the calculation (normally also numbers have only a few digits). @@ -2135,7 +2351,10 @@ \exp_not:n {#4} \@@_digits:nn \l_@@_min_decimal_int {#4} } - { \tl_if_blank:nF {#5} { \@@_digits_uncert:nnn {#4} #5 } } + { + \tl_if_blank:nF {#5} + { \@@_digits_uncert:nnw {#4} #5 \q_stop } + } \exp_not:n { {#6} {#7} } } \cs_new:Npn \@@_digits:nn #1#2 @@ -2144,12 +2363,26 @@ { #1 - \tl_count:n {#2} } > 0 { \prg_replicate:nn { #1 - \tl_count:n {#2} } { 0 } } } -\cs_new:Npn \@@_digits_uncert:nnn #1#2#3 +\cs_new:Npn \@@_digits_uncert:nnw #1#2#3 \q_stop { { #2 } - { \use:c { @@_digits_uncert_ #2 :nn } {#1} {#3} } + \cs_if_exist:cTF { @@_digits_uncert_ #2 :nn } + { { \use:c { @@_digits_uncert_ #2 :nn } {#1} {#3} } } + { + \@@_digits_uncert:nN {#1} #2 \q_recursion_tail + #3 \q_recursion_stop + } + } +\cs_new:Npn \@@_digits_uncert_A:nn #1#2 + { \@@_digits_uncert_A:nnn {#1} #2 } +\cs_new:Npn \@@_digits_uncert_A:nnn #1#2#3 + { + { \@@_digits_uncert_aux:nn {#1} {#2} } + { \@@_digits_uncert_aux:nn {#1} {#3} } } \cs_new:Npn \@@_digits_uncert_S:nn #1#2 + { \@@_digits_uncert_aux:nn {#1} {#2} } +\cs_new:Npn \@@_digits_uncert_aux:nn #1#2 { \exp_not:n {#2} \@@_digits:nn @@ -2160,12 +2393,25 @@ } {#2} } +\cs_new:Npn \@@_digits_uncert:nN #1#2 + { + \quark_if_recursion_tail_stop:N #2 + \@@_digits_uncert:nNw {#1} #2 + } +\cs_new:Npn \@@_digits_uncert:nNw #1#2#3 \q_recursion_tail #4 + { + { \use:c { @@_digits_uncert_ #2 :nn } {#1} {#4} } + \@@_digits_uncert:nN {#1} #3 \q_recursion_tail + } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\@@_drop_exponent:NN} % \begin{macro}[EXP]{\@@_drop_exponent:nnnnnnn} @@ -2255,7 +2501,7 @@ % \@@_round_engineering:nn , % \@@_round_fixed:nn , % \@@_round_input:nn , -% \@@_round_scientifitc:nn +% \@@_round_scientific:nn % } % \begin{macro}[EXP]{\@@_round_engineering:NNNNn} % \begin{macro}[EXP]{\@@_round_engineering:nnN} @@ -2763,17 +3009,19 @@ { \@@_round_places_finalise:nnnnnnn #1 } \cs_new:Npn \@@_round_places_finalise:nnnnnnn #1#2#3#4#5#6#7 { - \bool_lazy_and:nnTF - { \str_if_eq_p:nn {#3} { 0 } } - { - \str_if_eq_p:ee - { \exp_not:n {#4} } { \prg_replicate:nn { \tl_count:n {#4} } { 0 } } - } + \str_if_eq:eeTF + { \exp_not:n {#3#4} } + { \prg_replicate:nn { \tl_count:n {#3#4} } { 0 } } { \tl_if_empty:NTF \l_@@_round_min_tl { \exp_not:n { {#1} } - { \str_if_eq:nnF {#2} { - } { \exp_not:n {#2} } } + { + \bool_lazy_and:nnF + { \l_@@_round_positive_bool } + { \str_if_eq_p:nn {#2} { - } } + { \exp_not:n {#2} } + } \exp_not:n { {#3} {#4} {#5} {#6} {#7} } } { @@ -3107,23 +3355,28 @@ % % \begin{variable} % { -% \l_@@_bracket_negative_bool , -% \l_@@_implicit_plus_bool , -% \l_@@_exponent_base_tl , -% \l_@@_exponent_product_tl , -% \l_@@_group_decimal_bool , -% \l_@@_group_integer_bool , -% \l_@@_group_minimum_int , -% \l_@@_group_separator_tl , -% \l_@@_negative_color_tl , -% \l_@@_output_exp_marker_tl , -% \l_@@_output_uncert_close_tl , -% \l_@@_output_uncert_open_tl , -% \l_@@_uncert_mode_tl , -% \l_@@_uncert_separator_tl , -% \l_@@_tight_bool , -% \l_@@_unity_mantissa_bool , -% \l_@@_zero_exponent_bool , +% \l_@@_bracket_negative_bool , +% \l_@@_implicit_plus_bool , +% \l_@@_exponent_base_tl , +% \l_@@_exponent_product_tl , +% \l_@@_group_size_int , +% \l_@@_group_first_int , +% \l_@@_group_decimal_bool , +% \l_@@_group_integer_bool , +% \l_@@_group_minimum_int , +% \l_@@_group_separator_tl , +% \l_@@_negative_color_tl , +% \l_@@_output_exp_marker_tl , +% \l_@@_output_uncert_close_tl , +% \l_@@_output_uncert_open_tl , +% \l_@@_uncert_desc_mode_tl , +% \l_@@_uncert_desc_separator_tl , +% \l_@@_uncert_desc_clist , +% \l_@@_uncert_mode_tl , +% \l_@@_uncert_separator_tl , +% \l_@@_tight_bool , +% \l_@@_unity_mantissa_bool , +% \l_@@_zero_exponent_bool , % \l_@@_zero_integer_bool % } % Keys producing tokens in the output. @@ -3138,6 +3391,15 @@ \l_@@_exponent_base_tl , exponent-product .tl_set:N = \l_@@_exponent_product_tl , + digit-group-size .meta:n = + { + digit-group-first-size = {#1} , + digit-group-other-size = {#1} + } , + digit-group-first-size .int_set:N = + \l_@@_group_first_int , + digit-group-other-size .int_set:N = + \l_@@_group_size_int , group-digits .choice: , group-digits / all .code:n = { @@ -3184,14 +3446,25 @@ \l_@@_zero_integer_bool , tight-spacing .bool_set:N = \l_@@_tight_bool , + uncertainty-descriptor-mode .choices:nn = + { bracket , bracket-separator , separator , subscript } + { \tl_set_eq:NN \l_@@_uncert_desc_mode_tl \l_keys_choice_tl } , + uncertainty-descriptor-separator .tl_set:N = + \l_@@_uncert_desc_separator_tl , + uncertainty-descriptors .clist_set:N = + \l_@@_uncert_desc_clist , uncertainty-mode .choices:nn = { compact , compact-marker , full , separate } { \tl_set_eq:NN \l_@@_uncert_mode_tl \l_keys_choice_tl } , uncertainty-separator .tl_set:N = - \l_@@_uncert_separator_tl + \l_@@_uncert_separator_tl , + zero-decimal-as-symbol .bool_set:N = + \l_@@_zero_symbol_bool , + zero-symbol .tl_set:N = \l_@@_zero_symbol_tl } \bool_new:N \l_@@_group_decimal_bool \bool_new:N \l_@@_group_integer_bool +\tl_new:N \l_@@_uncert_desc_mode_tl \tl_new:N \l_@@_uncert_mode_tl % \end{macrocode} % \end{variable} @@ -3213,25 +3486,49 @@ % \begin{macro}[rEXP]{\@@_output_integer:nnn} % \begin{macro}[rEXP]{\@@_output_decimal:nn, \@@_output_decimal:fn} % \begin{macro}[rEXP]{\@@_output_digits:nn} -% \begin{macro}[rEXP]{\@@_output_integer_aux:n} +% \begin{macro}[rEXP]{\@@_output_digit_separator:N} +% \begin{macro}[rEXP]{\@@_output_integer_3_3:n} % \begin{macro}[rEXP] % { % \@@_output_integer_aux_0:n, % \@@_output_integer_aux_1:n, % \@@_output_integer_aux_2:n % } -% \begin{macro}[rEXP]{\@@_output_decimal_aux:n} -% \begin{macro}[rEXP]{\@@_output_decimal_loop:NNNN} % \begin{macro}[rEXP]{\@@_output_integer_first:nnNN} % \begin{macro}[rEXP]{\@@_output_integer_loop:NNNN} +% \begin{macro}[rEXP]{\@@_output_integer_first:n} +% \begin{macro}[rEXP]{\@@_output_integer_aux:n} +% \begin{macro}[rEXP]{\@@_output_integer_loop:NnnN} +% \begin{macro}[rEXP]{\@@_output_decimal_3_3:n} +% \begin{macro}[rEXP]{\@@_output_decimal_loop:NNNN} +% \begin{macro}[rEXP]{\@@_output_decimal_3_2:n} +% \begin{macro}[rEXP]{\@@_output_decimal:NNNw} +% \begin{macro}[rEXP]{\@@_output_decimal_loop:NN} +% \begin{macro}[rEXP]{\@@_output_decimal_first:n} +% \begin{macro}[rEXP]{\@@_output_decimal_loop:NnnN} % \begin{macro}[rEXP]{\@@_output_uncertainty:nnn} % \begin{macro}[rEXP]{\@@_output_uncertainty_unaligned:n} -% \begin{macro}[rEXP]{\@@_output_uncert_S:nnnw} +% \begin{macro}[rEXP]{\@@_output_uncert:nnnn} +% \begin{macro}[rEXP]{\@@_output_uncert:nnnnn} +% \begin{macro}[rEXP]{\@@_output_uncert_loop:nnN} +% \begin{macro}[rEXP]{\@@_output_uncert_loop:nnNw} % \begin{macro}[rEXP] -% {\@@_output_uncert_S_aux:nnn, \@@_output_uncert_S_aux:fnn} +% { +% \@@_output_uncert_desc_bracket:n , +% \@@_output_uncert_desc_bracket-separator:n , +% \@@_output_uncert_desc_separator:n , +% \@@_output_uncert_desc_subscript:n +% } +% \begin{macro}[rEXP]{\@@_output_uncert_A_loop:nnn, \@@_output_uncert_S_loop:nnn} +% \begin{macro}[rEXP]{\@@_output_uncert_S_loop:w} +% \begin{macro}[rEXP]{\@@_output_uncert_A:nnnn, \@@_output_uncert_A_multi:nnnn} +% \begin{macro}[rEXP]{\@@_output_uncert_A:nnnnn} % \begin{macro}[rEXP] -% {\@@_output_uncert_S:nnnw, \@@_output_uncert_S:fnw} -% \begin{macro}[rEXP]{\@@_output_uncert_S:nnw} +% { +% \@@_output_uncert_S:nnnn , +% \@@_output_uncert_S_sep:nnnn , +% \@@_output_uncert_S_multi:nnnn +% } % \begin{macro}[rEXP] % { % \@@_output_uncert_S_compact:nn , @@ -3239,6 +3536,13 @@ % \@@_output_uncert_S_full:nn % } % \begin{macro}[rEXP] +% {\@@_output_uncert_augment:nnnn} +% \begin{macro}[rEXP] +% {\@@_output_uncert_augment:nnn} +% \begin{macro}[rEXP] +% {\@@_output_uncert_augment:nnnw, \@@_output_uncert_augment:fnnw} +% \begin{macro}[rEXP]{\@@_output_uncert_augment:nnw} +% \begin{macro}[rEXP] % { % \@@_output_exponent:nnnnn , % \@@_output_exponent_auxi:nnnnn , @@ -3420,7 +3724,17 @@ } \exp_not:n {#2} \str_if_eq:nnF {#1} { \empty } - { \@@_output_digits:nn { decimal } {#1} } + { + \bool_lazy_and:nnTF + { \l_@@_zero_symbol_bool } + { + \str_if_eq_p:ee + {#1} + { \prg_replicate:nn { \tl_count:n {#1} } { 0 } } + } + { \exp_not:V \l_@@_zero_symbol_tl } + { \@@_output_digits:nn { decimal } {#1} } + } } \cs_generate_variant:Nn \@@_output_decimal:nn { f } \cs_new:Npn \@@_output_digits:nn #1#2 @@ -3430,16 +3744,37 @@ \int_compare:nNnTF { \tl_count:n {#2} } < \l_@@_group_minimum_int { \exp_not:n {#2} } - { \use:c { @@_output_ #1 _aux:n } {#2} } + { + \cs_if_exist_use:cF + { + @@_output_ #1 _ + \int_use:N \l_@@_group_first_int + _ + \int_use:N \l_@@_group_size_int + :n + } + { \use:c { @@_output_ #1 _first:n } } + {#2} + } } { \exp_not:n {#2} } } % \end{macrocode} -% For integers, we need to know how many digits there are to allow for the -% correct insertion of separators. That is done using a two-part set up such -% that there is no separator on the first pass. +% An auxiliary to ensure spacing is correct. % \begin{macrocode} -\cs_new:Npn \@@_output_integer_aux:n #1 +\cs_new:Npn \@@_output_digit_separator:N #1 + { + \str_if_eq:VnTF #1 { , } + { \exp_not:N \mathord } + { \use:n } + { \exp_not:V #1 } + } +% \end{macrocode} +% For standard grouping of integers, we need to know how many digits there +% are to allow for the correct insertion of separators. That is done using +% a two-part set up such that there is no separator on the first pass. +% \begin{macrocode} +\cs_new:cpn { @@_output_integer_3_3:n } #1 { \use:c { @@ -3462,21 +3797,51 @@ } \cs_new:Npn \@@_output_integer_loop:NNNN #1#2#3#4 { - \str_if_eq:VnTF \l_@@_group_separator_tl { , } - { \exp_not:N \mathord } - { \use:n } - { \exp_not:V \l_@@_group_separator_tl } + \@@_output_digit_separator:N \l_@@_group_separator_tl \exp_not:n {#1#2#3} \quark_if_nil:NF #4 { \@@_output_integer_loop:NNNN #4 } } % \end{macrocode} -% For decimals, no need to do any counting, just loop using enough markers to -% find the end of the list. By passing the decimal marker, it is possible not -% to have to use a check on the content of the rest of the number. The -% |\use_none:n(n)| mop up the remaining |\q_nil| tokens. +% There is no clever way of doing an uneven integer grouping, so just provide +% a slow generic approach. This is more-or-less the same as the generic +% decimal code, but with the output reversed. The only wrinkle is we need to +% reverse the entire input again, so it has to be carried as an argument. % \begin{macrocode} -\cs_new:Npn \@@_output_decimal_aux:n #1 +\cs_new:Npn \@@_output_integer_first:n #1 + { + \exp_args:Ne \@@_output_integer_aux:n { \tl_reverse:n {#1} } + } +\cs_new:Npn \@@_output_integer_aux:n #1 + { + \@@_output_integer_loop:NnnN \l_@@_group_first_int { 0 } { } + #1 \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \@@_output_integer_loop:NnnN #1#2#3#4 + { + \quark_if_recursion_tail_stop_do:Nn #4 {#3} + \int_compare:nNnTF { #2 + 1 } > #1 + { + \@@_output_integer_loop:NnnN + \l_@@_group_size_int { 1 } + { + \exp_not:n {#4} + \@@_output_digit_separator:N \l_@@_group_separator_tl + #3 + } + } + { + \@@_output_integer_loop:NnnN #1 { #2 + 1 } + { \exp_not:n {#4} #3 } + } + } +% \end{macrocode} +% For standard decimal grouping, no need to do any counting, just loop using +% enough markers to find the end of the list. By passing the decimal marker, +% it is possible not to have to use a check on the content of the rest of +% the number. The |\use_none:n(n)| mop up the remaining |\q_nil| tokens. +% \begin{macrocode} +\cs_new:cpn { @@_output_decimal_3_3:n } #1 { \@@_output_decimal_loop:NNNN \c_empty_tl #1 \q_nil \q_nil \q_nil @@ -3485,7 +3850,7 @@ { \quark_if_nil:NF #2 { - \exp_not:V #1 + \@@_output_digit_separator:N #1 \exp_not:n {#2} \quark_if_nil:NTF #3 { \use_none:n } @@ -3502,38 +3867,185 @@ } } % \end{macrocode} -% Uncertainties which are directly attached are easy to deal with. For those -% that are separated, the first step is to find if they are entirely -% contained within the decimal part, and to pad if they are. For the case -% where the boundary is crossed to the integer part, the correct number of -% digit tokens need to be removed from the start of the uncertainty and -% the split result sent to the appropriate auxiliaries. +% The same trick for the group-of-two case, but as the first pass is already +% done, there is not need to worry about the separator. +% \begin{macrocode} +\cs_new:cpn { @@_output_decimal_3_2:n } #1 + { + \int_compare:nNnTF { \tl_count:n {#1} } > 2 + { \@@_output_decimal:NNNw #1 \q_stop } + { \exp_not:n {#1} } + } +\cs_new:Npn \@@_output_decimal:NNNw #1#2#3#4 \q_stop + { + \exp_not:n {#1#2#3} + \@@_output_decimal_loop:NN #4 \q_nil \q_nil + } +\cs_new:Npn \@@_output_decimal_loop:NN #1#2 + { + \quark_if_nil:NF #1 + { + \@@_output_digit_separator:N + \l_@@_group_separator_tl + \exp_not:n {#1} + \quark_if_nil:NTF #2 + { \use_none:n } + { + \exp_not:n {#2} + \@@_output_decimal_loop:NN + } + } + } +% \end{macrocode} +% The generic decimal separator: simply count the digits. +% \begin{macrocode} +\cs_new:Npn \@@_output_decimal_first:n #1 + { + \@@_output_decimal_loop:NnnN \l_@@_group_first_int { 0 } { } + #1 \q_recursion_tail \q_recursion_stop + } +\cs_new:Npn \@@_output_decimal_loop:NnnN #1#2#3#4 + { + \quark_if_recursion_tail_stop_do:Nn #4 { \exp_not:n {#3} } + \int_compare:nNnTF { #2 + 1 } > #1 + { + \exp_not:n {#3} + \@@_output_digit_separator:N + \l_@@_group_separator_tl + \@@_output_decimal_loop:NnnN \l_@@_group_size_int { 1 } {#4} + } + { \@@_output_decimal_loop:NnnN #1 { #2 + 1 } { #3 #4 } } + } +% \end{macrocode} +% The lead-off here is to deal with the common cases: no uncertainty at all +% or a single uncertainty. Otherwise we have to move to a mapping. % \begin{macrocode} \cs_new:Npn \@@_output_uncertainty:nnn #1#2#3 { \tl_if_blank:nTF {#1} { \@@_output_uncertainty_unaligned:n {#3} } { - \use:c { @@_output_uncert_ \tl_head:n {#1} :nnnw } - {#2} {#3} #1 + \cs_if_exist:cTF + { @@_output_uncert_ \tl_head:n {#1} :nnnn } + { + \use:c { @@_output_uncert_ \tl_head:n {#1} :nnnn } + {#2} {#3} #1 + } + { \@@_output_uncert:nnnn {#2} {#3} #1 } } } \cs_new:Npn \@@_output_uncertainty_unaligned:n #1 { \exp_not:n { #1 #1 #1 #1 } } -\cs_new:Npn \@@_output_uncert_S:nnnw #1#2#3#4 +% \end{macrocode} +% For handling a list of uncertainties, we also need the descriptors. There +% is no way to reasonably deal with alignment of an open-ended list, so +% the treatment is as-for no uncertainty at all. +% \begin{macrocode} +\cs_new:Npn \@@_output_uncert:nnnn #1#2#3#4 { - \str_if_eq:VnTF \l_@@_uncert_mode_tl { separate } + \exp_args:NV \@@_output_uncert:nnnnn \l_@@_uncert_desc_clist + {#1} {#2} {#3} {#4} + } +\cs_new:Npn \@@_output_uncert:nnnnn #1#2#3#4#5 + { + \@@_output_uncert_loop:nnN {#2} {#3} + #4 \q_recursion_tail #1 , \q_recursion_stop {#5} + } +\cs_new:Npn \@@_output_uncert_loop:nnN #1#2#3 + { + \quark_if_recursion_tail_stop:N #3 + \@@_output_uncert_loop:nnNw {#1} {#2} #3 + } +\cs_new:Npn \@@_output_uncert_loop:nnNw + #1#2#3#4 \q_recursion_tail #5 , #6 \q_recursion_stop #7 + { + \use:c { @@_output_uncert_ #3 _loop:nnn } {#1} {#2} {#7} + \tl_if_blank:nF {#5} + { \use:c { @@_output_uncert_desc_ \l_@@_uncert_desc_mode_tl :n } {#5} } + \@@_output_uncert_loop:nnN {#1} {#2} #4 + \q_recursion_tail #6 , \q_recursion_stop + } +\cs_new:Npn \@@_output_uncert_desc_bracket:n #1 + { + \exp_not:V \l_@@_bracket_open_tl + \exp_not:V \l_siunitx_unit_font_tl + { \exp_not:n {#1} } + \exp_not:V \l_@@_bracket_close_tl + } +\cs_new:cpn { @@_output_uncert_desc_bracket-separator:n } #1 + { + \exp_not:V \l_@@_uncert_desc_separator_tl + \exp_not:V \l_@@_bracket_open_tl + \exp_not:V \l_siunitx_unit_font_tl + { \exp_not:n {#1} } + \exp_not:V \l_@@_bracket_close_tl + } +\cs_new:Npn \@@_output_uncert_desc_separator:n #1 + { + \exp_not:V \l_@@_uncert_desc_separator_tl + \exp_not:V \l_siunitx_unit_font_tl + { \exp_not:n {#1} } + } +\cs_new:Npx \@@_output_uncert_desc_subscript:n #1 + { + \char_generate:nn { `\_ } { 8 } { - \exp_not:n {#2} - \bool_if:NTF \l_@@_tight_bool - { \mathord } - { \use:n } - { \exp_not:n { \pm } } - \exp_not:n {#2} - \@@_output_uncert_S_aux:nnn - { \int_eval:n { \tl_count:n {#4} - \tl_count:n {#1} } } - {#4} {#2} + \exp_not:N \exp_not:V \exp_not:N \l_siunitx_unit_font_tl + { \exp_not:N \exp_not:n {#1} } } + } +% \end{macrocode} +% Here, we have to tidy up so the alignment point only applies to the first +% |S|-type uncertainty. +% \begin{macrocode} +\cs_new:Npn \@@_output_uncert_A_loop:nnn #1#2#3 + { \@@_output_uncert_A_multi:nnnn {#1} {#2} { A } {#3} } +\cs_new:Npn \@@_output_uncert_S_loop:nnn #1#2#3 + { + \@@_output_uncert_S_multi:nnnn {#1} {#2} { S } {#3} + \@@_output_uncert_S_loop:w + } +\cs_new:Npn \@@_output_uncert_S_loop:w #1 \@@_output_uncert_loop:nnN #2#3 + { + #1 + \@@_output_uncert_loop:nnN {#2} { } + } +% \end{macrocode} +% Printing an asymmetrical uncertainty is more straight-forward as they are +% always given in a single format. The only issue is handling the catcode. +% \begin{macrocode} +\cs_new:Npn \@@_output_uncert_A:nnnn #1#2#3#4 + { \@@_output_uncert_A:nnnnn {#1} {#2} {#3} #4 } +\cs_new_eq:NN \@@_output_uncert_A_multi:nnnn + \@@_output_uncert_A:nnnn +\cs_new:Npx \@@_output_uncert_A:nnnnn #1#2#3#4#5 + { + ^ + { + + + \exp_not:N \@@_output_uncert_augment:nnnn + {#4} {#1} {#4} {#2} + } + \char_generate:nn { `\_ } { 8 } + { + - + \exp_not:N \@@_output_uncert_augment:nnnn + {#5} {#1} {#5} {#2} + } + \exp_not:N \@@_output_uncertainty_unaligned:n {#2} + } +% \end{macrocode} +% Uncertainties which are directly attached are easy to deal with. For those +% that are separated, the first step is to find if they are entirely +% contained within the decimal part, and to pad if they are. For the case +% where the boundary is crossed to the integer part, the correct number of +% digit tokens need to be removed from the start of the uncertainty and +% the split result sent to the appropriate auxiliaries. +% \begin{macrocode} +\cs_new:Npn \@@_output_uncert_S:nnnn #1#2#3#4 + { + \str_if_eq:VnTF \l_@@_uncert_mode_tl { separate } + { \@@_output_uncert_S_sep:nnnn {#1} {#2} {#3} {#4} } { \exp_not:V \l_@@_uncert_separator_tl \exp_not:V \l_@@_output_uncert_open_tl @@ -3542,11 +4054,51 @@ \@@_output_uncertainty_unaligned:n {#2} } } -\cs_new:Npn \@@_output_uncert_S_aux:nnn #1#2#3 +\cs_new:Npn \@@_output_uncert_S_sep:nnnn #1#2#3#4 + { + \exp_not:n {#2} + \bool_if:NTF \l_@@_tight_bool + { \mathord } + { \use:n } + { \exp_not:n { \pm } } + \exp_not:n {#2} + \@@_output_uncert_augment:nnnn {#4} {#1} {#4} {#2} + } +\cs_new_eq:NN \@@_output_uncert_S_multi:nnnn + \@@_output_uncert_S_sep:nnnn +% \end{macrocode} +% Handle the content of brackets: the only complex case is the +% mixed situation. +% \begin{macrocode} +\cs_new:Npn \@@_output_uncert_S_compact:nn #1#2 + { \exp_not:n {#2} } +\cs_new:cpn { @@_output_uncert_S_compact-marker:nn } #1#2 + { + \bool_lazy_or:nnTF + { \tl_if_blank_p:n {#1} } + { ! \int_compare_p:nNn { \tl_count:n {#2} } > { \tl_count:n {#1} } } + { \@@_output_uncert_S_compact:nn } + { \@@_output_uncert_S_full:nn } + {#1} {#2} + } +\cs_new:Npn \@@_output_uncert_S_full:nn #1#2 + { + \@@_output_uncert_augment:nnnn {#2} {#1} {#2} { } + } +% \end{macrocode} +% Convert the internal (short) form of an uncertainty to the longer form. +% \begin{macrocode} +\cs_new:Npn \@@_output_uncert_augment:nnnn #1#2#3#4 + { + \exp_args:Nf \@@_output_uncert_augment:nnn + { \int_eval:n { \tl_count:n {#1} - \tl_count:n {#2} } } + {#3} {#4} + } +\cs_new:Npn \@@_output_uncert_augment:nnn #1#2#3 { \int_compare:nNnTF {#1} > 0 { - \@@_output_uncert_S_aux:fnnw + \@@_output_uncert_augment:fnnw { \int_eval:n { #1 - 1 } } {#3} { } @@ -3562,49 +4114,27 @@ {#3} } } -\cs_generate_variant:Nn \@@_output_uncert_S_aux:nnn { f } -\cs_new:Npn \@@_output_uncert_S_aux:nnnw #1#2#3#4 +\cs_new:Npn \@@_output_uncert_augment:nnnw #1#2#3#4 { \quark_if_nil:NF #4 { \int_compare:nNnTF {#1} = 0 - { \@@_output_uncert_S_aux:nnw {#3#4} {#2} } + { \@@_output_uncert_augment:nnw {#3#4} {#2} } { - \@@_output_uncert_S_aux:fnnw + \@@_output_uncert_augment:fnnw { \int_eval:n { #1 - 1 } } {#2} {#3#4} } } } -\cs_generate_variant:Nn \@@_output_uncert_S_aux:nnnw { f } -\cs_new:Npn \@@_output_uncert_S_aux:nnw #1#2#3 \q_nil +\cs_generate_variant:Nn \@@_output_uncert_augment:nnnw { f } +\cs_new:Npn \@@_output_uncert_augment:nnw #1#2#3 \q_nil { \@@_output_digits:nn { integer } {#1} \@@_output_decimal:nn {#3} {#2} } % \end{macrocode} -% Handle the content of brackets: the only complex case is the -% mixed situation. -% \begin{macrocode} -\cs_new:Npn \@@_output_uncert_S_compact:nn #1#2 - { \exp_not:n {#2} } -\cs_new:cpn { @@_output_uncert_S_compact-marker:nn } #1#2 - { - \bool_lazy_or:nnTF - { \tl_if_blank_p:n {#1} } - { ! \int_compare_p:nNn { \tl_count:n {#2} } > { \tl_count:n {#1} } } - { \@@_output_uncert_S_compact:nn } - { \@@_output_uncert_S_full:nn } - {#1} {#2} - } -\cs_new:Npn \@@_output_uncert_S_full:nn #1#2 - { - \@@_output_uncert_S_aux:fnn - { \int_eval:n { \tl_count:n {#2} - \tl_count:n {#1} } } - {#2} { } - } -% \end{macrocode} % Setting the exponent part requires some information about the mantissa: % was it there or not. This means that whilst only the sign and value for % the exponent are typeset here, there is a need to also have access to the @@ -3707,6 +4237,24 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \subsection{Miscellaneous tools} % @@ -3820,51 +4368,61 @@ % \begin{macrocode} \keys_set:nn { siunitx } { - bracket-ambiguous-numbers = true , - bracket-negative-numbers = false , - drop-exponent = false , - drop-uncertainty = false , - drop-zero-decimal = false , - evaluate-expression = false , - exponent-base = 10 , - exponent-mode = input , - exponent-product = \times , - expression = #1 , - fixed-exponent = 0 , - group-digits = all , - group-minimum-digits = 5 , - group-separator = \, , % ( - input-close-uncertainty = ) , - input-comparators = { <=>\approx\ge\geq\gg\le\leq\ll\sim } , - input-decimal-markers = { ., } , - input-digits = 0123456789 , - input-exponent-markers = dDeE , - input-ignore = \, , - input-open-uncertainty = ( , % ) - input-signs = +-\mp\pm , - input-uncertainty-signs = \pm , - minimum-decimal-digits = 0 , - minimum-integer-digits = 0 , - negative-color = , % ( - output-close-uncertainty = ) , - output-decimal-marker = . , - output-open-uncertainty = ( , % ) - parse-numbers = true , - print-implicit-plus = false , - print-unity-mantissa = true , - print-zero-exponent = false , - print-zero-integer = true , - retain-explicit-decimal-marker = false , - retain-explicit-plus = false , - retain-zero-uncertainty = false , - round-half = up , - round-minimum = 0 , - round-mode = none , - round-pad = true , - round-precision = 2 , - tight-spacing = false , - uncertainty-mode = compact , - uncertainty-separator = + bracket-ambiguous-numbers = true , + bracket-negative-numbers = false , + drop-exponent = false , + drop-uncertainty = false , + drop-zero-decimal = false , + evaluate-expression = false , + exponent-base = 10 , + exponent-mode = input , + exponent-product = \times , + expression = #1 , + fixed-exponent = 0 , + digit-group-size = 3 , + digit-group-first-size = 3 , + digit-group-other-size = 3 , + group-digits = all , + group-minimum-digits = 5 , + group-separator = \, , % ( + input-close-uncertainty = ) , + input-comparators = { <=>\approx\ge\geq\gg\le\leq\ll\sim } , + input-decimal-markers = { ., } , + input-digits = 0123456789 , + input-exponent-markers = dDeE , + input-ignore = \, , + input-open-uncertainty = ( , % ) + input-signs = +-\mp\pm , + input-uncertainty-signs = \pm , + minimum-decimal-digits = 0 , + minimum-integer-digits = 0 , + negative-color = , % ( + output-close-uncertainty = ) , + output-decimal-marker = . , + output-open-uncertainty = ( , % ) + parse-numbers = true , + print-implicit-plus = false , + print-unity-mantissa = true , + print-zero-exponent = false , + print-zero-integer = true , + retain-explicit-decimal-marker = false , + retain-explicit-plus = false , + retain-negative-zero = false , + retain-zero-uncertainty = false , + round-half = up , + round-minimum = 0 , + round-mode = none , + round-pad = true , + round-precision = 2 , + round-zero-positive = true , + tight-spacing = false , + uncertainty-descriptor-mode = bracket-separator , + uncertainty-descriptor-separator = \ , + uncertainty-descriptors = , + uncertainty-mode = compact , + uncertainty-separator = , + zero-decimal-as-symbol = false , + zero-symbol = \mbox { --- } } % \end{macrocode} % diff --git a/macros/latex/contrib/siunitx/siunitx-print.dtx b/macros/latex/contrib/siunitx/siunitx-print.dtx index cb63a0e325..0a7348ee66 100644 --- a/macros/latex/contrib/siunitx/siunitx-print.dtx +++ b/macros/latex/contrib/siunitx/siunitx-print.dtx @@ -241,6 +241,16 @@ % The mappings between text and math weight are set . The standard setting is |false|. % \end{function} % +% \begin{function}{text-subscript-command, text-superscript-command} +% \begin{syntax} +% |text-subscript-command| = \meta{cmd} +% |text-superscript-command| = \meta{cmd} +% \end{syntax} +% Sets the command used when printing material in sub- or superscript +% positions in text mode. The standard settings are \cs{textsubscript} +% and \cs{textsuperscript}, respectively. +% \end{function} +% % \begin{function}{unit-color} % \begin{syntax} % |unit-color| = \meta{color} @@ -345,6 +355,8 @@ % \l_@@_math_version_bool , % \l_@@_math_family_bool , % \l_@@_text_font_tl , +% \l_@@_text_sub_tl , +% \l_@@_text_super_tl , % \l_@@_math_series_bool % } % Options which apply to the main formatting routine, and so are not tied @@ -380,6 +392,10 @@ \l_@@_math_family_bool , text-font-command .tl_set:N = \l_@@_text_font_tl , + text-subscript-command .tl_set:N = + \l_@@_text_sub_tl , + text-superscript-command .tl_set:N = + \l_@@_text_super_tl , text-series-to-math .bool_set:N = \l_@@_math_series_bool , unit-color .tl_set:N = @@ -797,7 +813,7 @@ % \begin{macro}{\@@_text_replace:Nnnn} % \begin{macro}{\@@_text_replace_frac:n} % \begin{macro}{\@@_text_sub:n, \@@_text_super:n} -% \begin{macro}{\@@_text_scripts:NnN} +% \begin{macro}{\@@_text_scripts:nnN} % \begin{macro}{\@@_text_scripts:} % \begin{macro}{\@@_text_scripts_one:NnN} % \begin{macro}{\@@_text_scripts_two:NnNn} @@ -844,18 +860,29 @@ \tl_set:Nn \l_@@_tmp_tl {#1} \tl_if_empty:NF \l_@@_tmp_tl { - \tl_if_empty:NF \l_siunitx_unit_font_tl - { \exp_after:wN \cs_set_eq:NN \l_siunitx_unit_font_tl \use:n } - \cs_set:Npn \mathord ##1 - { \@@_text_replace_first:N ##1 } - \cs_set:Npn \pm { \: \exp_not:N \textpm \: } - \tl_map_inline:nn - { \mp \ge \le \gg \ll } - { \cs_set:Npn ##1 { \exp_not:N \ensuremath { \exp_not:N ##1 } } } - \cs_set:Npn \cdot { \: \exp_not:N \textperiodcentered \: } - \cs_set:Npn \times { \: \exp_not:N \texttimes \: } - \protected@edef \l_@@_tmp_tl - { \exp_after:wN \@@_text_replace_first:N \l_@@_tmp_tl } + \tl_if_empty:NF \l_siunitx_unit_font_tl + { \exp_after:wN \cs_set_eq:NN \l_siunitx_unit_font_tl \use:n } + \cs_set:Npn \mathord ##1 + { \@@_text_replace_first:N ##1 } + \group_begin: + \cs_set:Npn \pm { \: \exp_not:N \textpm \: } + \tl_map_inline:nn + { \mp \ge \le \gg \ll \angle } + { + \cs_set:Npn ##1 + { \exp_not:N \ensuremath { \exp_not:N ##1 } } + } + \cs_set:Npn \cdot { \: \exp_not:N \textperiodcentered \: } + \cs_set:Npn \sqrt ##1 + { + \exp_not:N \ensuremath + { \exp_not:N \sqrt { \exp_not:N \text {##1} } } + } + \cs_set:Npn \times { \: \exp_not:N \texttimes \: } + \protected@edef \l_@@_tmp_tl + { \exp_after:wN \@@_text_replace_first:N \l_@@_tmp_tl } + \exp_args:NNNV \group_end: + \tl_set:Nn \l_@@_tmp_tl \l_@@_tmp_tl \@@_text_replace:N \l_@@_tmp_tl \@@_text_replace_aux:n { \tl_use:N \l_@@_tmp_tl } } @@ -935,15 +962,15 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_text_sub:n #1 { - \@@_text_scripts:NnN - \textsubscript {#1} \@@_text_super:n + \@@_text_scripts:VnN + \l_@@_text_sub_tl {#1} \@@_text_super:n } \cs_new_protected:Npn \@@_text_super:n #1 { - \@@_text_scripts:NnN - \textsuperscript {#1} \@@_text_sub:n + \@@_text_scripts:VnN + \l_@@_text_super_tl {#1} \@@_text_sub:n } -\cs_new_protected:Npn \@@_text_scripts:NnN #1#2#3 +\cs_new_protected:Npn \@@_text_scripts:nnN #1#2#3 { \cs_set_protected:Npn \@@_text_scripts: { @@ -956,6 +983,7 @@ } \peek_after:Nw \@@_text_scripts: } +\cs_generate_variant:Nn \@@_text_scripts:nnN { V } \cs_new_protected:Npn \@@_text_scripts: { } % \end{macrocode} % In the simple case of one script item, we have to do a search-and-replace @@ -1039,20 +1067,22 @@ % \begin{macrocode} \keys_set:nn { siunitx } { - color = , - mode = math , - number-color = , - number-mode = math , - propagate-math-font = false , - reset-math-version = true , - reset-text-shape = true , - reset-text-series = true , - reset-text-family = true , - text-family-to-math = false , - text-font-command = , - text-series-to-math = false , - unit-color = , - unit-mode = math + color = , + mode = math , + number-color = , + number-mode = math , + propagate-math-font = false , + reset-math-version = true , + reset-text-shape = true , + reset-text-series = true , + reset-text-family = true , + text-family-to-math = false , + text-font-command = , + text-subscript-command = \textsubscript , + text-superscript-command = \textsuperscript , + text-series-to-math = false , + unit-color = , + unit-mode = math } % \end{macrocode} % diff --git a/macros/latex/contrib/siunitx/siunitx-quantity.dtx b/macros/latex/contrib/siunitx/siunitx-quantity.dtx index e4dc93200e..4c311d5d08 100644 --- a/macros/latex/contrib/siunitx/siunitx-quantity.dtx +++ b/macros/latex/contrib/siunitx/siunitx-quantity.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: siunitx-quantity.dtx Copyright (C) 2018-2021 Joseph Wright +% File: siunitx-quantity.dtx Copyright (C) 2018-2022 Joseph Wright % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -151,7 +151,7 @@ % \begin{variable}{\l_@@_tmp_fp, \l_@@_tmp_tl} % Scratch space. % \begin{macrocode} -\tl_new:N \l_@@_tmp_fp +\fp_new:N \l_@@_tmp_fp \tl_new:N \l_@@_tmp_tl % \end{macrocode} % \end{variable} diff --git a/macros/latex/contrib/siunitx/siunitx-unit.dtx b/macros/latex/contrib/siunitx/siunitx-unit.dtx index cc3b5a2b41..7147db4275 100644 --- a/macros/latex/contrib/siunitx/siunitx-unit.dtx +++ b/macros/latex/contrib/siunitx/siunitx-unit.dtx @@ -33,7 +33,7 @@ \textsc { \exp_args:NV \tl_if_head_eq_charcode:nNTF \f@series { m } - { \tl_lower_case:n } + { \text_lowercase:n } { \use:n } {#1} } @@ -74,7 +74,7 @@ % \begin{documentation} % % This submodule is dedicated to formatting physical units. The main function, -% \cs{siunitx_unit_format:nN}, takes user input specify physical units and +% \cs{siunitx_unit_format:nN}, takes user input specifying physical units and % converts it into a formatted token list suitable for typesetting in math % mode. While the formatter will deal correctly with \enquote{literal} user % input, the key strength of the module is providing a method to describe @@ -84,15 +84,15 @@ % % A small number of \LaTeXe{} math mode commands are assumed to be available % as part of the formatted output. The \cs{mathchoice} command -% (normally the \TeX{} primitive) is needed when using -% |per-mode = symbol-or-fraction|. The commands \cs{frac}, \cs{mathrm}, +% (normally the \TeX{} primitive) is needed when using different settings +% for inline and siplay |per-mode|. The commands \cs{frac}, \cs{mathrm}, % \cs{mbox}, \verb*|\ | and \cs{,} are used by the standard module settings. % For the display of colored (highlighted) and cancelled units, the commands % \cs{textcolor} and \cs{cancel} are assumed to be available. % % \section{Formatting units} % -% \begin{function}{\siunitx_unit_format:nN, \siunitx_unit_format:xN} +% \begin{function}{\siunitx_unit_format:nN} % \begin{syntax} % \cs{siunitx_unit_format:nN} \Arg{units} \meta{tl~var} % \end{syntax} @@ -552,8 +552,7 @@ % \end{syntax} % Switch to determine whether brackets are added to the denominator part of % a unit when printed using inline fractional form (with |per-mode| as -% |repeated-symbol|, |symbol| or |symbol-or-fraction|). The standard setting -% is |true|. +% |repeated-symbol| or |symbol|). The standard setting is |true|. % \end{function} % % \begin{function}{extract-mass-in-kilograms} @@ -596,14 +595,14 @@ % mode is used directly. The standard setting is |true|. % \end{function} % -% \begin{function}{per-mode} +% \begin{function}{per-mode, inline-per-mode, display-per-mode} % \begin{syntax} -% |per-mode| = |fraction|\verb"|"|power|\verb"|"|power-positive-first|\verb"|"|repeated-symbol|\verb"|"|symbol|\verb"|"|symbol-or-fraction| +% |per-mode| = |fraction|\verb"|"|power|\verb"|"|power-positive-first|\verb"|"|repeated-symbol|\verb"|"|single-symbol|\verb"|"|symbol| % \end{syntax} % Selects how the negative powers (\cs{per}) are formatted: a choice from % the options |fraction|, |power|, |power-positive-first|, |repeated-symbol|, -% |symbol| and |symbol-or-fraction|. The option |fraction| generates -% fractional output when appropriate using the command specified by +% |single-symbol| and |symbol|. The option |fraction| +% generates fractional output when appropriate using the command specified by % the |fraction-command| option. The setting |power| uses reciprocal powers % leaving the units in the order of input, while |power-positive-first| uses % the same display format but sorts units such that the positive powers @@ -611,9 +610,14 @@ % by |per-symbol|) between positive and negative powers, while % |repeated-symbol| uses the same symbol but places it before \emph{every} % unit with a negative power (this is mathematically \enquote{wrong} but -% often seen in real work). Finally, |symbol-or-fraction| acts like -% |symbol| for inline output and like |fraction| when the output is used -% in a display math environment. The standard setting is |power|. +% often seen in real work). The option |single-symbol| will use a symbol if +% exactly one is required (\foreign{i.e.}~with a single negative power), and +% will otherwise use powers. The standard setting is |power|. +% +% The |inline-...| and |display-...| settings take the same options and work +% in exactly the same way, but are restricted in where they apply. The +% |display| version only applies in display math contexts, and the |inline| +% version applies in all others. % \end{function} % % \begin{function}{per-symbol} @@ -621,8 +625,25 @@ % |per-symbol| = \meta{symbol} % \end{syntax} % Specifies the symbol to be used to denote negative powers when the option -% |per-mode| is set to |repeated-symbol|, |symbol| or |symbol-or-fraction|. -% The standard setting is |/|. +% |per-mode| is set to |repeated-symbol| or |symbol|. The standard setting +% is |/|. +% \end{function} +% +% \begin{function}{per-symbol-script-correction} +% \begin{syntax} +% |per-symbol-script-correction| = \meta{insert} +% \end{syntax} +% Specifies the tokens used to correct spacing when the symbol set by +% |per-symbol| is immediately preceded by a superscript power. The +% standard setting is |\!|. +% \end{function} +% +% \begin{function}{power-half-as-sqrt} +% \begin{syntax} +% |power-half-as-sqrt| = |true|\verb"|"|false| +% \end{syntax} +% Used to determine whether a power of exactly half is converted to +% \cs{sqrt} in the output. The standard setting is |false| % \end{function} % % \begin{function}{qualifier-mode} @@ -692,11 +713,13 @@ \cs_generate_variant:Nn \tl_replace_all:Nnn { NnV } % \end{macrocode} % +% \begin{variable}{\l_@@_tmp_bool} % \begin{variable}{\l_@@_tmp_fp} % \begin{variable}{\l_@@_tmp_int} % \begin{variable}{\l_@@_tmp_tl} % Scratch space. % \begin{macrocode} +\bool_new:N \l_@@_tmp_bool \fp_new:N \l_@@_tmp_fp \int_new:N \l_@@_tmp_int \tl_new:N \l_@@_tmp_tl @@ -704,6 +727,7 @@ % \end{variable} % \end{variable} % \end{variable} +% \end{variable} % % \begin{variable}{\c_@@_math_subscript_tl} % Useful tokens with awkward category codes. @@ -1120,7 +1144,7 @@ } { \bool_if:NTF \l_@@_forbid_literal_bool - { \msg_error:nnn { siunitx } { unit / literal } {#1} } + { \msg_error:nnn { siunitx } { literal-unit } {#1} } { \@@_format_literal:n {#1} } } } @@ -1482,7 +1506,7 @@ \prop_if_in:NVTF \l_@@_parsed_prop \l_@@_tmp_tl { - \msg_error:nnxx { siunitx } { unit / duplicate-part } + \msg_error:nnxx { siunitx } { duplicate-part } { \exp_not:n {#1} } { \token_to_str:N #3 } } { @@ -1530,7 +1554,7 @@ } { \msg_error:nnxx { siunitx } - { unit / part-before-unit } { power } { \token_to_str:N #1 } + { part-before-unit } { power } { \token_to_str:N #1 } } } \cs_new_protected:Npn \@@_parse_qualifier:nn #1#2 @@ -1544,7 +1568,7 @@ } { \msg_error:nnnn { siunitx } - { unit / part-before-unit } { qualifier } { \token_to_str:N #1 } + { part-before-unit } { qualifier } { \token_to_str:N #1 } } } % \end{macrocode} @@ -1606,7 +1630,7 @@ { \bool_set_true:N \l_@@_per_bool \cs_set_protected:Npn \per - { \msg_error:nn { siunitx } { unit / duplicate-sticky-per } } + { \msg_error:nn { siunitx } { duplicate-sticky-per } } } { \@@_parse_add:nnnn @@ -1670,7 +1694,7 @@ \tl_set:Nx \l_@@_tmp_tl { ##1 - \int_eval:n { \l_@@_position_int + 1 } } \prop_if_in:NVT \l_@@_parsed_prop \l_@@_tmp_tl - { \msg_error:nnn { siunitx } { unit / dangling-part } { ##1 } } + { \msg_error:nnn { siunitx } { dangling-part } { ##1 } } } } % \end{macrocode} @@ -1685,6 +1709,8 @@ % \l_@@_forbid_literal_bool , % \l_@@_parse_bool , % \l_@@_per_symbol_tl , +% \l_@@_per_script_tl , +% \l_@@_half_sqrt_bool , % \l_@@_qualifier_mode_tl , % \l_@@_qualifier_phrase_tl % } @@ -1694,57 +1720,40 @@ { bracket-unit-denominator .bool_set:N = \l_@@_denominator_bracket_bool , + display-per-mode .choices:nn = + { + fraction , + power , + power-positive-first , + repeated-symbol , + symbol , + single-symbol + } + { \str_set:Nn \l_@@_per_display_str {#1} } , forbid-literal-units .bool_set:N = \l_@@_forbid_literal_bool , fraction-command .tl_set:N = \l_siunitx_unit_fraction_tl , parse-units .bool_set:N = \l_@@_parse_bool , - per-mode .choice: , - per-mode / fraction .code:n = + inline-per-mode .choices:nn = { - \bool_set_false:N \l_@@_autofrac_bool - \bool_set_false:N \l_@@_per_symbol_bool - \bool_set_true:N \l_@@_powers_positive_bool - \bool_set_true:N \l_@@_two_part_bool - } , - per-mode / power .code:n = - { - \bool_set_false:N \l_@@_autofrac_bool - \bool_set_false:N \l_@@_per_symbol_bool - \bool_set_false:N \l_@@_powers_positive_bool - \bool_set_false:N \l_@@_two_part_bool - } , - per-mode / power-positive-first .code:n = - { - \bool_set_false:N \l_@@_autofrac_bool - \bool_set_false:N \l_@@_per_symbol_bool - \bool_set_false:N \l_@@_powers_positive_bool - \bool_set_true:N \l_@@_two_part_bool - } , - per-mode / repeated-symbol .code:n = - { - \bool_set_false:N \l_@@_autofrac_bool - \bool_set_true:N \l_@@_per_symbol_bool - \bool_set_true:N \l_@@_powers_positive_bool - \bool_set_false:N \l_@@_two_part_bool - } , - per-mode / symbol .code:n = - { - \bool_set_false:N \l_@@_autofrac_bool - \bool_set_true:N \l_@@_per_symbol_bool - \bool_set_true:N \l_@@_powers_positive_bool - \bool_set_true:N \l_@@_two_part_bool - } , - per-mode / symbol-or-fraction .code:n = - { - \bool_set_true:N \l_@@_autofrac_bool - \bool_set_true:N \l_@@_per_symbol_bool - \bool_set_true:N \l_@@_powers_positive_bool - \bool_set_true:N \l_@@_two_part_bool - } , + fraction , + power , + power-positive-first , + repeated-symbol , + symbol , + single-symbol + } + { \str_set:Nn \l_@@_per_inline_str {#1} } , + per-mode .meta:n = + { display-per-mode = {#1} , inline-per-mode = {#1} } , per-symbol .tl_set:N = \l_@@_per_symbol_tl , + per-symbol-script-correction .tl_set:N = + \l_@@_per_script_tl , + power-half-as-sqrt .bool_set:N = + \l_@@_half_sqrt_bool , qualifier-mode .choices:nn = { bracket , combine , phrase , subscript } { \tl_set_eq:NN \l_@@_qualifier_mode_tl \l_keys_choice_tl } , @@ -1779,9 +1788,16 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_per_display_str, \l_@@_per_inline_str} +% The data storage for |per-mode| settings. +% \begin{macrocode} +\str_new:N \l_@@_per_display_str +\str_new:N \l_@@_per_inline_str +% \end{macrocode} +% \end{variable} +% % \begin{variable} % { -% \l_@@_autofrac_bool , % \l_@@_powers_positive_bool , % \l_@@_per_symbol_bool , % \l_@@_two_part_bool @@ -1789,7 +1805,6 @@ % Dealing with the various ways that reciprocal (\cs{per}) can be handled % requires a few different switches. % \begin{macrocode} -\bool_new:N \l_@@_autofrac_bool \bool_new:N \l_@@_per_symbol_bool \bool_new:N \l_@@_powers_positive_bool \bool_new:N \l_@@_two_part_bool @@ -1844,6 +1859,17 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_current_script_bool, \l_@@_script_bool} +% A pair of flags to track whether the last entry in the numerator has a +% superscript. This is tracked to deal with spacing immediately before +% a slash (symbol), if required. Two flags are needed as otherwise the +% denominator interferes. +% \begin{macrocode} +\bool_new:N \l_@@_current_script_bool +\bool_new:N \l_@@_script_bool +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\l_@@_current_tl, \l_@@_part_tl} % Building up the (partial) formatted unit requires some token list storage. % Each part of the unit combination that is recovered also has to be @@ -1873,14 +1899,42 @@ % \end{variable} % % \begin{macro}{\@@_format_parsed:} -% \begin{macro}{\@@_format_parsed_aux:n} +% \begin{macro} +% {\@@_format_parsed:n, \@@_format_parsed:V, \@@_format_parsed_aux:n} % The main formatting routine is essentially a loop over each position, % reading the various parts of the unit to build up complete unit -% combination. +% combination. When the two types of output need to be different, the +% formatter has to be run twice. % \begin{macrocode} \cs_new_protected:Npn \@@_format_parsed: { + \str_if_eq:NNTF + \l_@@_per_inline_str + \l_@@_per_display_str + { \@@_format_parsed:V \l_@@_per_inline_str } + { + \group_begin: + \@@_format_parsed:V \l_@@_per_inline_str + \exp_args:NNNV \group_end: + \tl_set:Nn \l_@@_tmp_tl \l_@@_formatted_tl + \group_begin: + \@@_format_parsed:V \l_@@_per_display_str + \exp_args:NNNV \group_end: + \tl_set:Nn \l_@@_formatted_tl \l_@@_formatted_tl + \tl_set:Nx \l_@@_formatted_tl + { + \mathchoice + { \exp_not:V \l_@@_formatted_tl } + { \exp_not:V \l_@@_tmp_tl } + { \exp_not:V \l_@@_tmp_tl } + { \exp_not:V \l_@@_tmp_tl } + } + } + } +\cs_new_protected:Npn \@@_format_parsed:n #1 + { \int_set_eq:NN \l_@@_total_int \l_@@_position_int + \use:c { @@_format_init_ #1 : } \tl_clear:N \l_@@_denominator_tl \tl_clear:N \l_@@_formatted_tl \fp_zero:N \l_@@_prefix_fp @@ -1897,6 +1951,7 @@ \l_@@_position_int < \l_@@_total_int { \bool_set_false:N \l_@@_bracket_bool + \bool_set_false:N \l_@@_current_script_bool \tl_clear:N \l_@@_current_tl \bool_set_false:N \l_@@_font_bool \bool_set_true:N \l_@@_numerator_bool @@ -1907,6 +1962,7 @@ } \@@_format_finalise: } +\cs_generate_variant:Nn \@@_format_parsed:n { V } \cs_new_protected:Npn \@@_format_parsed_aux:n #1 { \tl_set:Nx \l_@@_tmp_tl @@ -1919,6 +1975,55 @@ % \end{macro} % \end{macro} % +% \begin{macro} +% { +% \@@_format_init_fracton: , +% \@@_format_init_power: , +% \@@_format_init_power-positive-first: , +% \@@_format_init_repeated-symbol: , +% \@@_format_init_symbol: , +% \@@_format_init_single-symbol: , +% } +% To set up the various versions of |per-mode|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_format_init_fraction: + { + \bool_set_false:N \l_@@_per_symbol_bool + \bool_set_true:N \l_@@_powers_positive_bool + \bool_set_true:N \l_@@_two_part_bool + } +\cs_new_protected:Npn \@@_format_init_power: + { + \bool_set_false:N \l_@@_per_symbol_bool + \bool_set_false:N \l_@@_powers_positive_bool + \bool_set_false:N \l_@@_two_part_bool + } +\cs_new_protected:cpn { @@_format_init_power-positive-first: } + { + \bool_set_false:N \l_@@_per_symbol_bool + \bool_set_false:N \l_@@_powers_positive_bool + \bool_set_true:N \l_@@_two_part_bool + } +\cs_new_protected:cpn { @@_format_init_repeated-symbol: } + { + \bool_set_true:N \l_@@_per_symbol_bool + \bool_set_true:N \l_@@_powers_positive_bool + \bool_set_false:N \l_@@_two_part_bool + } +\cs_new_protected:Npn \@@_format_init_symbol: + { + \bool_set_true:N \l_@@_per_symbol_bool + \bool_set_true:N \l_@@_powers_positive_bool + \bool_set_true:N \l_@@_two_part_bool + } +\cs_new_protected:cpn { @@_format_init_single-symbol: } + { + \@@_format_init_power: + \@@_format_symbol_or_power: + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_format_combine_exp:} % To combine an exponent into the first prefix, we first adjust for any % power, then deal with any existing prefix, before looking up the @@ -1936,7 +2041,7 @@ \l_@@_tmp_tl \l_@@_tmp_tl { \prop_get:NnN \l_@@_parsed_prop { prefix-1 } \l_@@_tmp_tl - \msg_error:nnx { siunitx } { unit / non-numeric-exponent } + \msg_error:nnx { siunitx } { non-numeric-exponent } { \l_@@_tmp_tl } \tl_set:Nn \l_@@_tmp_tl { 0 } } @@ -1951,7 +2056,7 @@ \l_@@_tmp_tl \l_@@_tmp_tl { \prop_put:NnV \l_@@_parsed_prop { prefix-1 } \l_@@_tmp_tl } { - \msg_error:nnx { siunitx } { unit / non-convertible-exponent } + \msg_error:nnx { siunitx } { non-convertible-exponent } { \l_@@_tmp_tl } } } @@ -2015,6 +2120,36 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_format_symbol_or_power:} +% Check if there is exactly one negative power align with at least one +% positive one. Assuming there is, flip from (effectively) |power| to +% |symbol|. +% \begin{macrocode} +\cs_new_protected:Npn \@@_format_symbol_or_power: + { + \int_compare:nNnT \l_@@_total_int > 1 + { + \bool_set_false:N \l_@@_tmp_bool + \int_step_inline:nn \l_@@_total_int + { + \prop_get:NnNT \l_@@_parsed_prop { power- ##1 } + \l_@@_tmp_tl + { + \int_compare:nNnT \l_@@_tmp_tl < 0 + { + \bool_if:NTF \l_@@_tmp_bool + { \bool_set_false:N \l_@@_tmp_bool } + { \bool_set_true:N \l_@@_tmp_bool } + } + } + } + \bool_if:NT \l_@@_tmp_bool + { \@@_format_init_symbol: } + } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[EXP]{\@@_format_bracket:N} % A quick utility function which wraps up a token list variable in brackets % if they are required. @@ -2033,7 +2168,7 @@ % \end{macro} % % \begin{macro}{\@@_format_power:} -% \begin{macro}[EXP]{\@@_format_power_aux:wTF} +% \begin{macro}[EXP]{\@@_format_power_aux:w} % \begin{macro} % { % \@@_format_power_positive: , @@ -2049,16 +2184,17 @@ \cs_new_protected:Npn \@@_format_power: { \@@_format_font: - \exp_after:wN \@@_format_power_aux:wTF + \exp_after:wN \@@_format_power_aux:w \l_@@_part_tl - \q_stop { \@@_format_power_negative: } { \@@_format_power_positive: } } -\cs_new:Npn \@@_format_power_aux:wTF #1 - #2 \q_stop +\cs_new:Npn \@@_format_power_aux:w #1 - #2 \q_stop { \tl_if_empty:nTF {#1} } % \end{macrocode} % In the case of positive powers, there is little to do: add the power -% as a subscript (must be required as the parser ensures it's $\neq 1$). +% as a superscript (the parser ensures that this is $\neq 1$, so we do not +% need a test here). % \begin{macrocode} \cs_new_protected:Npn \@@_format_power_positive: { \@@_format_power_superscript: } @@ -2088,14 +2224,24 @@ { \exp_not:n {#1} } % \end{macrocode} % Adding the power as a superscript has the slight complication that there -% is the possibility of needing some brackets. The superscript itself uses -% \cs{sp} as that avoids any category code issues and also allows redirection -% at a higher level more readily. +% is the possibility of needing some brackets. % \begin{macrocode} \cs_new_protected:Npn \@@_format_power_superscript: { - \exp_after:wN \@@_format_power_superscipt:w - \l_@@_part_tl . . \q_stop + \bool_lazy_and:nnTF + { \l_@@_half_sqrt_bool } + { \str_if_eq_p:Vn \l_@@_part_tl { 0.5 } } + { + \tl_set:Nx \l_@@_current_tl + { + \exp_not:N \sqrt + { \exp_not:V \l_@@_current_tl } + } + } + { + \exp_after:wN \@@_format_power_superscipt:w + \l_@@_part_tl . . \q_stop + } } \cs_new_protected:Npn \@@_format_power_superscipt:w #1 . #2 . #3 \q_stop { @@ -2123,8 +2269,9 @@ { \@@_format_bracket:N \l_@@_current_tl ^ { \siunitx_number_output:N \l_@@_tmp_tl } - } + } } + \bool_set_true:N \l_@@_current_script_bool \bool_set_false:N \l_@@_bracket_bool } % \end{macrocode} @@ -2210,6 +2357,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_format_qualifier: { + \bool_set_false:N \l_@@_current_script_bool \use:c { @@_format_qualifier_ @@ -2318,6 +2466,8 @@ } \cs_new_protected:Npn \@@_format_output_aux: { + \bool_set_eq:NN \l_@@_script_bool + \l_@@_current_script_bool \@@_format_output_aux:nV { formatted } \l_@@_product_tl } @@ -2427,36 +2577,9 @@ { \tl_if_empty:NT \l_@@_formatted_tl { \tl_set:Nn \l_@@_formatted_tl { 1 } } - \bool_if:NTF \l_@@_autofrac_bool - { \@@_format_finalise_autofrac: } - { - \bool_if:NTF \l_@@_per_symbol_bool - { \@@_format_finalise_symbol: } - { \@@_format_finalise_fraction: } - } - } -% \end{macrocode} -% For the \enquote{auto-selected} fraction method, the two other auxiliary -% functions are used to do both forms of formatting. So that everything -% required is available, this needs one group so that the second auxiliary -% receives the correct input. After that it is just a case of applying -% \cs{mathchoice} to the formatted output. -% \begin{macrocode} -\cs_new_protected:Npn \@@_format_finalise_autofrac: - { - \group_begin: - \@@_format_finalise_fraction: - \exp_args:NNNV \group_end: - \tl_set:Nn \l_@@_tmp_tl \l_@@_formatted_tl - \@@_format_finalise_symbol: - \tl_set:Nx \l_@@_formatted_tl - { - \mathchoice - { \exp_not:V \l_@@_tmp_tl } - { \exp_not:V \l_@@_formatted_tl } - { \exp_not:V \l_@@_formatted_tl } - { \exp_not:V \l_@@_formatted_tl } - } + \bool_if:NTF \l_@@_per_symbol_bool + { \@@_format_finalise_symbol: } + { \@@_format_finalise_fraction: } } % \end{macrocode} % When using a fraction function the two parts are now assembled. @@ -2470,11 +2593,17 @@ { \exp_not:V \l_@@_denominator_tl } } } +% \end{macrocode} +% Add the correction if required: no \cs{relax} needed as we know there is a +% non-expandable token following. +% \begin{macrocode} \cs_new_protected:Npn \@@_format_finalise_symbol: { \tl_set:Nx \l_@@_formatted_tl { \exp_not:V \l_@@_formatted_tl + \bool_if:NT \l_@@_script_bool + { \exp_not:V \l_@@_per_script_tl } \exp_not:V \l_@@_per_symbol_tl \@@_format_bracket:N \l_@@_denominator_tl } @@ -2761,43 +2890,43 @@ % \subsection{Messages} % % \begin{macrocode} -\msg_new:nnnn { siunitx } { unit / dangling-part } +\msg_new:nnnn { siunitx } { dangling-part } { Found~#1~part~with~no~unit. } { Each~#1~part~must~be~associated~with~a~unit:~a~#1~part~was~found~ but~no~following~unit~was~given. } -\msg_new:nnnn { siunitx } { unit / duplicate-part } +\msg_new:nnnn { siunitx } { duplicate-part } { Duplicate~#1~part:~#2. } { Each~unit~may~have~only~one~#1:\\ the~additional~#1~part~'#2'~will~be~ignored. } -\msg_new:nnnn { siunitx } { unit / duplicate-sticky-per } +\msg_new:nnnn { siunitx } { duplicate-sticky-per } { Duplicate~\token_to_str:N \per. } { When~the~'sticky-per'~option~is~active,~only~one~ \token_to_str:N \per \ may~appear~in~a~unit. } -\msg_new:nnnn { siunitx } { unit / literal } +\msg_new:nnnn { siunitx } { literal-unit } { Literal~units~disabled. } { You~gave~the~literal~input~'#1'~ but~literal~unit~output~is~disabled. } -\msg_new:nnnn { siunitx } { unit / non-convertible-exponent } +\msg_new:nnnn { siunitx } { non-convertible-exponent } { Exponent~'#1'~cannot~be~converted~into~a~symbolic~prefix. } { The~exponent~'#1'~does~not~match~with~any~of~the~symbolic~prefixes~ set~up. } -\msg_new:nnnn { siunitx } { unit / non-numeric-exponent } +\msg_new:nnnn { siunitx } { non-numeric-exponent } { Prefix~'#1'~does~not~have~a~numerical~value. } { The~prefix~'#1'~needs~to~be~combined~with~a~number,~but~it~has~no numerical~value. } -\msg_new:nnnn { siunitx } { unit / part-before-unit } +\msg_new:nnnn { siunitx } { part-before-unit } { Found~#1~part~before~first~unit:~#2. } { The~#1~part~'#2'~must~follow~after~a~unit:~ @@ -2805,6 +2934,31 @@ } % \end{macrocode} % +% \subsection{Deprecated options} +% +% To handle |per-mode = symbol-or-fraction|, there needs to be allowance for +% the fact that it is set up as a meta-option. That is done with appropriate +% code here for the two newer options. +% \begin{macrocode} +\keys_define:nn { siunitx } + { + display-per-mode / symbol-or-fraction .code:n = + { + \msg_info:nnnn { siunitx } { option-deprecated } + { per-mode~=~symbol-or-fraction } + { display-per-mode~=~fraction,~inline-per-mode~=~symbol } + \str_set:Nn \l_@@_per_display_str { fraction } + } , + inline-per-mode / symbol-or-fraction .code:n = + { + \msg_info:nnnn { siunitx } { option-deprecated } + { per-mode~=~symbol-or-fraction } + { display-per-mode~=~fraction,~inline-per-mode~=~symbol } + \str_set:Nn \l_@@_per_inline_str { symbol } + } + } +% \end{macrocode} +% % \subsection{Standard settings for module options} % % Some of these follow naturally from the point of definition @@ -2813,18 +2967,20 @@ % \begin{macrocode} \keys_set:nn { siunitx } { - bracket-unit-denominator = true , - forbid-literal-units = false , - fraction-command = \frac , - inter-unit-product = \, , - extract-mass-in-kilograms = true , - parse-units = true , - per-mode = power , - per-symbol = / , - qualifier-mode = subscript , - qualifier-phrase = , - sticky-per = false , - unit-font-command = \mathrm + bracket-unit-denominator = true , + forbid-literal-units = false , + fraction-command = \frac , + inter-unit-product = \, , + extract-mass-in-kilograms = true , + parse-units = true , + per-mode = power , + per-symbol = / , + per-symbol-script-correction = \! , + power-half-as-sqrt = false , + qualifier-mode = subscript , + qualifier-phrase = , + sticky-per = false , + unit-font-command = \mathrm } % \end{macrocode} % diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx index d1de5e34da..a5219ad957 100644 --- a/macros/latex/contrib/siunitx/siunitx.dtx +++ b/macros/latex/contrib/siunitx/siunitx.dtx @@ -121,7 +121,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2022-04-04} {3.0.50} +\ProvidesExplPackage {siunitx} {2022-04-25} {3.1.0} {A comprehensive (SI) units package} % \end{macrocode} % @@ -144,11 +144,11 @@ { } } \clist_map_function:nN - { SIunits , sistyle , unitsdef , fancyunits } + { SIunits , sistyle , units , unitsdef , fancyunits } \@@_load_check:n \AtBeginDocument { - \clist_map_function:nN { SIunits , sistyle } + \clist_map_function:nN { SIunits , sistyle , units } \@@_load_check:n } % \end{macrocode} @@ -199,6 +199,35 @@ % % \subsection{Option handling} % +% Some messages. +% \begin{macrocode} +\msg_new:nnn { siunitx } { option-deprecated } + { + Option~"#1"~has~been~deprecated~in~this~release.\\ \\ + Use~"#2"~as~a~replacement. + } +% \end{macrocode} +% +% \begin{variable}{\g_@@_deprecated_seq} +% Used to avoid repeatedly warning about deprecated options: needed at the +% top level. +% \begin{macrocode} +\seq_new:N \g_@@_deprecated_seq +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\@@_deprecated_info:nn} +% To avoid repeated messages. +% \begin{macrocode} +\cs_new_protected:Npn \@@_deprecated_info:nn #1#2 + { + \seq_if_in:NnF \g_@@_deprecated_seq {#1} + { \msg_info:nnnn { siunitx } { option-deprecated } {#1} {#2} } + \seq_gput_right:Nn \g_@@_deprecated_seq {#1} + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} \IfFormatAtLeastTF { 2022-06-01 } { \ProcessKeyOptions [ siunitx ] } @@ -266,16 +295,34 @@ % % \begin{macro}{\qty} % \begin{macrocode} -\@ifpackageloaded { physics } +\AtBeginDocument { - \msg_new:nnn { siunitx } { physics-pkg } + \@ifpackageloaded { physics } { - Detected~the~"physics"~package: \\ - Omitting~definition~of~\token_to_str:N \qty. + \msg_new:nnn { siunitx } { physics-pkg } + { + Detected~the~"physics"~package: \\ + omitting~definition~of~\token_to_str:N \qty. + \\ \\ + If~you~want~to~use~\qty with~the~siunitx~definition,~add~ + \\ \\ + \iow_indent:n + { + \token_to_str:N \AtBeginDocument + { + \token_to_str:N \RenewCommandCopy + \token_to_str:N \qty \token_to_str:N \SI + } + } + \\ \\ + to~your~preamble. + } + \msg_warning:nn { siunitx } { physics-pkg } } - \msg_warning:nn { siunitx } { physics-pkg } - \use_none:nnnn + { } } +\@ifpackageloaded { physics } + { \use_none:nnnn } { } \NewDocumentCommand \qty { O { } m > { \TrimSpaces } m } { @@ -310,17 +357,6 @@ \siunitx_print_number:V \l_@@_tmp_tl \group_end: } -\@ifpackageloaded { units } - { - \msg_new:nnn { siunitx } { units-pkg } - { - Detected~the~"units"~package: \\ - Omitting~definition~of~\token_to_str:N \unit. - } - \msg_warning:nn { siunitx } { units-pkg } - \use_none:nnnn - } - { } \NewDocumentCommand \unit { O { } > { \TrimSpaces } m } { \mode_leave_vertical: @@ -398,21 +434,29 @@ % \begin{macro}{\complexnum, \complexqty} % Interfaces for complex numbers. % \begin{macrocode} -\NewDocumentCommand \complexnum { O { } m } +\use:e + { + \NewDocumentCommand \exp_not:N \complexnum + { O { } > { \SplitArgument { 1 } { \c_colon_str } } m } + } { \mode_leave_vertical: \group_begin: \keys_set:nn { siunitx } {#1} - \siunitx_complex_number:n {#2} \l_@@_tmp_tl + \@@_complex_number_aux:nn #2 \group_end: } -\NewDocumentCommand \complexqty { O { } m m } +\use:e + { + \NewDocumentCommand \exp_not:N \complexqty + { O { } > { \SplitArgument { 1 } { \c_colon_str } } m m } + } { \mode_leave_vertical: \group_begin: \siunitx_unit_options_apply:n {#3} \keys_set:nn { siunitx } {#1} - \siunitx_complex_quantity:nn {#2} {#3} + \@@_complex_quantity_aux:nnn #2 {#3} \group_end: } % \end{macrocode} @@ -461,6 +505,26 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_complex_number_aux:nn} +% \begin{macro}{\@@_complex_quantity_aux:nnn} +% The same idea for complex values. +% \begin{macrocode} +\cs_new_protected:Npn \@@_complex_number_aux:nn #1#2 + { + \tl_if_novalue:nTF {#2} + { \siunitx_complex_number:n {#1} } + { \siunitx_complex_number:nn {#1} {#2} } + } +\cs_new_protected:Npn \@@_complex_quantity_aux:nnn #1#2#3 + { + \tl_if_novalue:nTF {#2} + { \siunitx_complex_quantity:nn {#1} {#3} } + { \siunitx_complex_quantity:nnn {#1} {#2} {#3} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Table column} % % User interfaces in tabular constructs are provided using the mechanisms from diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf Binary files differindex f66535f7ea..0f234b75d9 100644 --- a/macros/latex/contrib/siunitx/siunitx.pdf +++ b/macros/latex/contrib/siunitx/siunitx.pdf diff --git a/macros/latex/contrib/siunitx/siunitx.tex b/macros/latex/contrib/siunitx/siunitx.tex index 8854ff3f75..b10016c3b4 100644 --- a/macros/latex/contrib/siunitx/siunitx.tex +++ b/macros/latex/contrib/siunitx/siunitx.tex @@ -46,7 +46,7 @@ for those people who are interested. \textsc { \exp_args:NV \tl_if_head_eq_charcode:nNTF \f@series { m } - { \tl_lower_case:n } + { \text_lowercase:n } { \use:n } {#1} } @@ -79,7 +79,7 @@ for those people who are interested. } % For demos -\usepackage[french,german,polish,spanish,UKenglish]{babel} +\usepackage[portuguese,brazilian,catalan,french,german,polish,spanish,UKenglish]{babel} \AtBeginDocument{\shorthandoff{:<>}} \usepackage{translations} \usepackage{cancel} @@ -508,18 +508,20 @@ adjustment of the numerical values. \cs{complexnum}\oarg{options}\marg{number} \end{syntax} \end{function} -Typesets the complex number, which must be given in the form $a + b\mathrm{i}$ -or $a + \mathrm{i}b$. Processing of the numerical parts is otherwise identical -to the standard \cs{num} command. +Typesets the complex number, which can be given in the Cartesian form $a + +b\mathrm{i}$ or $a + \mathrm{i}b$, or in the polar form $r$\texttt{:}$\theta$. +Processing of the numerical parts is otherwise identical to the standard +\cs{num} command. \begin{function}{\complexqty} \begin{syntax} \cs{complexqty}\oarg{options}\marg{number}\marg{unit} \end{syntax} \end{function} -Typesets the complex quantity, which must be given in the form $a + b\mathrm{i}$ -or $a + \mathrm{i}b$. Processing of the numerical parts is otherwise identical -to the standard \cs{qty} command. +Typesets the complex number, which can be given in the Cartesian form $a + +b\mathrm{i}$ or $a + \mathrm{i}b$, or in the polar form $r$\texttt{:}$\theta$. +Processing of the numerical parts is otherwise identical to the standard +\cs{qty} command. \subsection{The unit macros} @@ -833,6 +835,7 @@ occur (for example with the standard \cs{pm} symbol). \midrule \DescribeUnit[watt]{W} \\ + \DescribeUnit[nanowatt]{nW} \\ \DescribeUnit[microwatt]{uW} \\ \DescribeUnit[milliwatt]{mW} \\ \DescribeUnit[kilowatt]{kW} \\ @@ -861,11 +864,21 @@ occur (for example with the standard \cs{pm} symbol). \midrule \DescribeUnit[henry]{H} \\ + \DescribeUnit[femtohenry]{fH} \\ + \DescribeUnit[picohenry]{pH} \\ + \DescribeUnit[nanohenry]{nH} \\ \DescribeUnit[millihenry]{mH} \\ \DescribeUnit[microhenry]{uH} \\ \midrule + \DescribeUnit[coulomb]{C} \\ + \DescribeUnit[nanocoulomb]{nC} \\ + \DescribeUnit[millicoulomb]{mC} \\ + \DescribeUnit[microcoulomb]{uC} \\ + + \midrule + \DescribeUnit[kelvin]{K} \\ \midrule @@ -1116,20 +1129,22 @@ Table~\ref{tab:opt:print}. Type & \multicolumn{1}{l@{}}{Default} \\ \midrule - color & Literal & \meta{none} \\ - mode & Choice & math \\ - number-color & Literal & \meta{none} \\ - number-mode & Choice & math \\ - propagate-math-font & Switch & false \\ - reset-math-version & Switch & true \\ - reset-text-family & Switch & true \\ - reset-text-series & Switch & true \\ - reset-text-shape & Switch & true \\ - text-family-to-math & Switch & false \\ - text-font-command & Literal & \meta{none} \\ - text-series-to-math & Switch & false \\ - unit-color & Literal & \meta{none} \\ - unit-mode & Choice & math \\ + color & Literal & \meta{none} \\ + mode & Choice & math \\ + number-color & Literal & \meta{none} \\ + number-mode & Choice & math \\ + propagate-math-font & Switch & false \\ + reset-math-version & Switch & true \\ + reset-text-family & Switch & true \\ + reset-text-series & Switch & true \\ + reset-text-shape & Switch & true \\ + text-family-to-math & Switch & false \\ + text-font-command & Literal & \meta{none} \\ + text-subscript-command & Literal & \cs{textsubscript} \\ + text-superscript-command & Literal & \cs{textsuperscript} \\ + text-series-to-math & Switch & false \\ + unit-color & Literal & \meta{none} \\ + unit-mode & Choice & math \\ \bottomrule \end{tabular} \end{table} @@ -1224,6 +1239,24 @@ font variant which does not feature them. \qty{123456789}{\kilo\volt\per\centi\metre} \end{LaTeXdemo} +\DescribeOption{text-subscript-command} +\DescribeOption{text-superscript-command} +In most cases, the commands \cs{textsubscript} and \cs{textsuperscript} are +appropriagte for creating sub- and superscript material in text mode. However, +when the \pkg{realscripts} package is loaded, it is possible that the output is +not as desired. These two commands are therefore available to allow tuning of +the results. They can also be used for non-standard effects, for example as +here adding color to subscripts. +\begin{LaTeXdemo} + \sisetup{unit-mode = text} + \unit{\kg\of{polymer}} \\ + \newcommand*\mysubscript[1]{% + \textsubscript{\textcolor{blue}{#1}}% + } + \sisetup{text-subscript-command = \mysubscript} + \unit{\kg\of{polymer}} +\end{LaTeXdemo} + \DescribeOption{color} \DescribeOption{number-color} \DescribeOption{unit-color} @@ -1272,6 +1305,7 @@ Table~\ref{tab:opt:num:in}. parse-numbers & Switch & true \\ retain-explicit-decimal-marker & Switch & false \\ retain-explicit-plus & Switch & false \\ + retain-negative-zero & Switch & false \\ retain-zero-uncertainty & Switch & false \\ \bottomrule \end{tabular} @@ -1331,6 +1365,12 @@ marker is seen in for example some \acro{NIST} publications.} \num{123.4(12)} \\ \num{123.4(1.2)} \end{LaTeXdemo} +Multiple uncertainties may also be given: these must all either be in the short +or the long form. +\begin{LaTeXdemo} + \num{123.4(12)(45)} \\ + \num{123.4 \pm 1.2 \pm 4.5} +\end{LaTeXdemo} \DescribeOption{parse-numbers} The \opt{parse-numbers} option turns the entire parsing system on and off. The @@ -1364,6 +1404,7 @@ most notably in that a decimal marker must be |.|. \DescribeOption{retain-explicit-decimal-marker} \DescribeOption{retain-explicit-plus} +\DescribeOption{retain-negative-zero} \DescribeOption{retain-zero-uncertainty} In some areas, a trailing decimal marker with no decimal part present is used to show that zeros in the integer part are significant. This can be enabled @@ -1372,13 +1413,16 @@ leading plus sign is usually unnecessary for positive numbers, and so they are not retained as-standard when parsing. The \opt{retain-explicit-plus} option is available to control this behaviour. Similarly, an uncertainty of zero is normally not meaningful, and so is ignored by the parser. This can be -controlled using the -\opt{retain-zero-uncertainty} option. +controlled using the \opt{retain-zero-uncertainty} option. Finally, a negative +sign for an entirely zero value may or may not have significance: this is +controlled by the \opt{retain-negative-zero} option. \begin{LaTeXdemo} \num{10.} \\ \num[retain-explicit-decimal-marker]{10.} \\ \num{+345} \\ \num[retain-explicit-plus]{+345} \\ + \num{-0} \\ + \num[retain-negative-zero]{-0} \\ \num{12.3(0)} \\ \num[retain-zero-uncertainty]{12.3(0)} \end{LaTeXdemo} @@ -1409,6 +1453,7 @@ way; the options are summarised in Table~\ref{tab:opt:num:post}. round-mode & Choice & none \\ round-pad & Switch & true \\ round-precision & Integer & 2 \\ + round-zero-positive & Switch & true \\ \bottomrule \end{tabular} \end{table} @@ -1542,6 +1587,18 @@ possible to obtain the value zero in these cases. \num{0.0045} \end{LaTeXdemo} +\DescribeOption{round-zero-positive} +When rounding negative numbers to a fixed number of places, a zero value may +result. Usually this is expressed as an unsigned value, but in some cases +retaining the negative sign may be desirable. This behaviour can be controlled +using the \opt{round-zero-positive} switch. +\begin{LaTeXdemo} + \sisetup{round-mode = places}% + \num{-0.001} \\ + \sisetup{round-zero-positive = false}% + \num{-0.001} +\end{LaTeXdemo} + \DescribeOption{drop-zero-decimal} It may be desirable to convert decimals to integers when the decimal part is zero. This is set up using the \opt{drop-zero-decimal} option, which applies @@ -1582,24 +1639,32 @@ conveys. The options are summarised in Table~\ref{tab:opt:num:out}. Type & \multicolumn{1}{l}{Default} \\ \midrule - bracket-negative-numbers & Switch & false \\ - exponent-base & Literal & 10 \\ - exponent-product & Math & \verb=\times= \\ - group-digits & Choice & all \\ - group-minimum-digits & integer & 5 \\ - group-separator & Literal & \cs{,} \\ - negative-color & Literal & \meta{none} \\ ^^A ( - output-close-uncertainty & Literal & ) \\ - output-decimal-marker & Literal & . \\ - output-exponent-marker & Literal & \meta{none} \\ - output-open-uncertainty & Literal & ( \\ ^^A ) - print-implicit-plus & Switch & false \\ - print-unity-mantissa & Switch & true \\ - print-zero-exponent & Switch & false \\ - print-zero-integer & Switch & false \\ - tight-spacing & Switch & false \\ - uncertainty-mode & Choice & compact \\ - uncertainty-separator & Literal & \meta{none} \\ + bracket-negative-numbers & Switch & false \\ + digit-group-size & Integer & 3 \\ + digit-group-first-size & Integer & 3 \\ + digit-group-other-size & Integer & 3 \\ + exponent-base & Literal & 10 \\ + exponent-product & Math & \verb=\times= \\ + group-digits & Choice & all \\ + group-minimum-digits & Integer & 5 \\ + group-separator & Literal & \cs{,} \\ + negative-color & Literal & \meta{none} \\ ^^A ( + output-close-uncertainty & Literal & ) \\ + output-decimal-marker & Literal & . \\ + output-exponent-marker & Literal & \meta{none} \\ + output-open-uncertainty & Literal & ( \\ ^^A ) + print-implicit-plus & Switch & false \\ + print-unity-mantissa & Switch & true \\ + print-zero-exponent & Switch & false \\ + print-zero-integer & Switch & false \\ + tight-spacing & Switch & false \\ + uncertainty-descriptor-mode & Choice & bracket-separator \\ + uncertainty-descriptor-separator & Literal & \cs{ } \\ + uncertainty-descriptors & Literal & \meta{none} \\ + uncertainty-mode & Choice & compact \\ + uncertainty-separator & Literal & \meta{none} \\ + zero-decimal-as-symbol & Switch & false \\ + zero-symbol & Literal & \verb=\mbox{---}= \\ \bottomrule \end{tabular} \end{table} @@ -1643,6 +1708,21 @@ separately for the integer and decimal parts of the number: grouping does not \num[group-minimum-digits = 5]{12345.67890} \end{LaTeXdemo} +\DescribeOption{digit-group-size} +\DescribeOption{digit-group-first-size} +\DescribeOption{digit-group-other-size} +The number of digits in each group can be controlled by the setting +\opt{digit-group-size}, which has standard value $3$. Finer control can be +achieved using \opt{digit-group-first-size} and \opt{digit-group-other-size}: +the first group is that immediately by the decimal point, the other value +applies to the second and subsequent groupings. These can be used for +example to achieve the grouping typically used in India (lakh). +\begin{LaTeXdemo} + \num{1234567890} \\ + \num[digit-group-size = 5]{1234567890} \\ + \num[digit-group-other-size = 2]{1234567890} +\end{LaTeXdemo} + \DescribeOption{output-decimal-marker} The decimal marker used in output is set using the \opt{output-decimal-marker} option; this can differ from the input marker. @@ -1672,9 +1752,9 @@ stored will be used in place of the normal product and base combination. \DescribeOption{output-open-uncertainty} \DescribeOption{output-close-uncertainty} \DescribeOption{uncertainty-separator} -When input is given including an uncertainty in a number, it can be printed -either with the uncertainty in brackets or as a separate number. This behaviour -is controlled by the \opt{uncertainty-mode} choice.When this is set to +When input is given including a single uncertainty, it can be printed either +with the uncertainty in brackets or as a separate number. This behaviour is +controlled by the \opt{uncertainty-mode} choice. When this is set to \opt{separate}, the uncertainty is printed as an entirely separate number preceded by \cs{pm}. Other settings all place the uncertainty in brackets directly attached to the main value. The standard setting of \opt{compact} @@ -1707,6 +1787,24 @@ respectively. Tokens may be inserted before the opening bracket using \num{1.234(5)} \end{LaTeXdemo} +\DescribeOption{uncertainty-descriptors} +\DescribeOption{uncertainty-descriptor-mode} +\DescribeOption{uncertainty-descriptor-separator} +Multiple uncertainties can be given for a number. These are always printed in a +separated form. When there is more than one uncertainty part, it may be useful +to describe the nature of this value. This can be achieved using the +\opt{uncertainty-descriptors} option, which take a comma-separated list of +descriptions. The formatting of the descriptors can be adjusted using the +settings \opt{uncertainty-descriptor-mode} and +\opt{uncertainty-descriptor-separator}. The choices for the \opt{mode} are +\opt{bracket}, \opt{bracket-separator}, \opt{separator} and \opt{subscript}. +\begin{LaTeXdemo} + \num{1.2(3)(4)} \\ + \sisetup{uncertainty-descriptors = {sys, stat}} + \num{1.2(3)(4)} \\ + \num[uncertainty-descriptor-mode = subscript]{1.2(3)(4)} +\end{LaTeXdemo} + \DescribeOption{bracket-ambiguous-numbers} There are certain combinations of numerical input which can be ambiguous. This can be corrected by adding brackets in the appropriate place, and is controlled @@ -1775,6 +1873,18 @@ printed (\foreign{i.e.}~\opt{print-zero-exponent} has a higher priority). \num[print-zero-integer = false]{0.123} \end{LaTeXdemo} +\DescribeOption{zero-decimal-as-symbol} +\DescribeOption{zero-symbol} +In some areas, particularly financial, entirely zero decimal parts are +replaced by a dash. This is supported by option \opt{zero-decimal-as-symbol}, +which then uses the material stored using \opt{zero-symbol} as the replacement. +\begin{LaTeXdemo} + \num{123.00} \\ + \sisetup{zero-decimal-as-symbol} + \num{123.00} \\ + \num[zero-symbol = \text{[{---}]}]{123.00} +\end{LaTeXdemo} + \subsection{Lists, products and ranges} Lists, products and ranges of numbers and quantities have a small number of @@ -1938,13 +2048,35 @@ numbers; these are summarised in Table~\ref{tab:opt:num:complex}. Type & \multicolumn{1}{l@{}}{Default} \\ \midrule + complex-angle-unit & Choice & degrees \\ + complex-mode & Choice & input \\ complex-root-position & Choice & after-number \\ + complex-symbol-angle & Literal & \cs{angle} \\ + complex-symbol-degree & Literal & \cs{degree} \\ input-complex-root & Literal & ij \\ output-complex-root & Literal & \verb=\mathrm{i}= \\ \bottomrule \end{tabular} \end{table} +\DescribeOption{complex-mode} +The format in which complex values are printed can be set using the +\opt{complex-mode} option. With the standard setting (\opt{input}), the complex +value is printed as-given. By setting the option to \opt{cartesian} or +\opt{polar}, the output format can be set to an Cartesian or polar form. +Conversion uses the \LaTeX3 floating-point unit, so is limited to $16$ decimal +places. When converting from Cartesian to polar form, the complex root symbol +must come at the \emph{end} of the imaginary part. It must also be specified +using \texttt{i}. +\begin{LaTeXdemo} + \complexnum{1 + i} \\ + \complexnum{1:45} \\ + \complexnum[complex-mode = cartesian]{1 + i} \\ + \complexnum[complex-mode = cartesian, round-mode = places]{1:45} \\ + \complexnum[complex-mode = polar]{1 + i} \\ + \complexnum[complex-mode = polar]{1:45} +\end{LaTeXdemo} + \DescribeOption{input-complex-root} When using complex numbers in input, the complex root $(\mathrm{i} = \sqrt{-1}\,)$ is indicated by one of the tokens stored in @@ -1974,6 +2106,21 @@ using the \opt{output-complex-root} setting. \complexnum[complex-root-position = after-number]{67-0.9i} \end{LaTeXdemo} +\DescribeOption{complex-angle-unit} +\DescribeOption{complex-symbol-angle} +\DescribeOption{complex-symbol-degree} +When printing or converting to polar form, the angle may be interpreted in +units set by \opt{complex-angle-unit}: one of \opt{degrees} or \opt{radians}. +The symbol used to denote the angle, and that used for units of degrees, +are controlled by the options \opt{complex-symbol-angle} and +\opt{complex-symbol-degree}, respectively. +\begin{LaTeXdemo} + \complexqty{1:1}{\ohm} \\ + \complexqty[complex-angle-unit = radians]{1:1}{\ohm} \\ + \complexqty[complex-symbol-angle = \mathrm{A}]{1:1}{\ohm} \\ + \complexqty[complex-symbol-degree = d]{1:1}{\ohm} +\end{LaTeXdemo} + \subsection{Angles} Angle processing provided by the \cs{ang} function has a set of options which @@ -2180,17 +2327,19 @@ the output directly (Table~\ref{tab:opt:units:out}). Type & \multicolumn{1}{l@{}}{Default} \\ \midrule - bracket-unit-denominator & Switch & true \\ - forbid-literal-units & Switch & false \\ - fraction-command & Literal & \cs{frac} \\ - inter-unit-product & Literal & \cs{,} \\ - parse-units & Switch & true \\ - per-mode & Choice & power \\ - per-symbol & Literal & / \\ - qualifier-mode & Choice & subscript \\ - qualifier-phrase & Literal & \meta{empty} \\ - sticky-per & Switch & false \\ - unit-font-command & Literal & \cs{mathrm} \\ + bracket-unit-denominator & Switch & true \\ + forbid-literal-units & Switch & false \\ + fraction-command & Literal & \cs{frac} \\ + inter-unit-product & Literal & \cs{,} \\ + parse-units & Switch & true \\ + per-mode & Choice & power \\ + per-symbol-script-correction & Literal & \cs{!} \\ + per-symbol & Literal & / \\ + power-half-as-sqrt & Switch & false \\ + qualifier-mode & Choice & subscript \\ + qualifier-phrase & Literal & \meta{empty} \\ + sticky-per & Switch & false \\ + unit-font-command & Literal & \cs{mathrm} \\ \bottomrule \end{tabular} \end{table} @@ -2207,6 +2356,8 @@ centred dot. To get the correct spacing it is necessary to use \end{LaTeXdemo} \DescribeOption{per-mode} +\DescribeOption{display-per-mode} +\DescribeOption{inline-per-mode} \DescribeOption{per-symbol} \DescribeOption{fraction-command} \DescribeOption{bracket-unit-denominator} @@ -2233,7 +2384,7 @@ unit by setting \opt{per-mode} to \opt{symbol}; the symbol used is stored using the setting \opt{per-symbol}. This method for displaying units can be ambiguous, and so brackets are added unless \opt{bracket-unit-denominator} is set to \opt{false}. Notice that \opt{bracket-unit-denominator} only applies -when \opt{per-mode} is set to \opt{symbol} or \opt{symbol-or-fraction}. +when \opt{per-mode} is set to \opt{symbol}. \begin{LaTeXdemo} \sisetup{per-mode = symbol}% \unit{\joule\per\mole\per\kelvin} \\ @@ -2246,12 +2397,26 @@ is also available to repeat the symbol for each \cs{per}. \begin{LaTeXdemo} \unit[per-mode = repeated-symbol]{\joule\per\mole\per\kelvin} \end{LaTeXdemo} -Finally, it is possible for the behaviour of the \cs{per} function to depend on -the prevailing math style. Setting \opt{per-mode} to \opt{symbol-or-fraction} -will use the \opt{symbol} setting for in line math, and the \opt{fraction} -setting when used in display math. +The use of a symbol can be restricted to the case where exactly one is +required: the setting \opt{single-symbol} will use a symbol if and only +if there are one or more positive powers and exactly one negative power. +In other cases, powers are used. +\begin{LaTeXdemo} + \sisetup{per-mode = single-symbol} + \qty{10}{\per\metre} \\ + \qty{20}{\metre\per\second} \\ + \qty{30}{\joule\per\mole\per\kelvin} +\end{LaTeXdemo} +It is possible for the behaviour of the \cs{per} function to depend on the +prevailing math style. Setting either \opt{display-per-mode} or +\opt{inline-per-mode} independently can be used to achieve this. For example, +the following example will will use the \opt{symbol} setting for in line math, +and the \opt{fraction} setting when used in display math. \begin{LaTeXdemo} - \sisetup{per-mode = symbol-or-fraction}% + \sisetup{ + display-per-mode = fraction , + inline-per-mode = symbol + }% $ \unit{\joule\per\mole\per\kelvin} $ \[ \unit{\joule\per\mole\per\kelvin} \] \unit{\joule\per\mole\per\kelvin} \\ @@ -2265,6 +2430,17 @@ setting when used in display math. \] \end{LaTeXdemo} +\DescribeOption{per-symbol-script-correction} +When using the \opt{symbol} setting for \opt{per-mode}, there may the need to +adjust spacing between a superscript power and the symbol. This is provided as +a command to be inserted between the two items: the standard value is a thin +negative space, \cs{!}. +\begin{LaTeXdemo} + \sisetup{per-mode = symbol}% + \unit{\cm\cubed\per\gram} \\ + \unit[per-symbol-script-correction = ]{\cm\cubed\per\gram} +\end{LaTeXdemo} + \DescribeOption{sticky-per} By default, \cs{per} applies only to the next unit given.\footnote{This is the standard method of reading units in English: for example, @@ -2299,6 +2475,15 @@ example a space or other linking text to be inserted. \unit{\kilogram\of{pol}\squared\per\mole\of{cat}\per\hour} \end{LaTeXdemo} +\DescribeOption{power-half-as-sqrt} +In some cases, the power of $0.5$ is shown by giving the unit symbol as a +square root. This can be enabled by setting \opt{power-half-as-sqrt} to +\opt{true} +\begin{LaTeXdemo} + \unit{\Hz\tothe{0.5}} \\ + \unit[power-half-as-sqrt]{\Hz\tothe{0.5}} +\end{LaTeXdemo} + \DescribeOption{parse-units} Normally, \pkg{siunitx} is used with the unit parse enabled, and only prints units directly if there is literal input. However, if the input is known to be @@ -3028,11 +3213,10 @@ unit which remains accepted. \section{Localisation} -The \pkg{translations} package provides a structured framework for localisation -of words and phrases, and is part of the larger \pkg{beamer} bundle. The -\pkg{translations} package provides the \cs{translate} macro, which will provide -appropriate translations based on the current \pkg{babel} or \pkg{polyglossia} -language setting. +The \pkg{translations} package provides a structured framework for +localisation of words and phrases. In particular, it offers the +\cs{GetTranslation} macro, which will provide appropriate translations based +on the current \pkg{babel} or \pkg{polyglossia} language setting. If \pkg{translations} is available, \pkg{siunitx} will load it and alter the standard settings for the \opt{list-final-separator} and \opt{range-phrase} @@ -3044,9 +3228,10 @@ options to read: range-phrase = { \GetTranslation{to (numerical range)} }, } \end{LaTeXdemo} -If the current language is known to the \pkg{translator} package then the +If the current language is known to the \pkg{translations} package then the result will be localised text. The preamble for this manual loads English, -French, German, Polish and Spanish as options, and also loads the \pkg{babel} package: +French, German, Polish, Spanish, Catalan, Portuguese and Brazilian as options, +and also loads the \pkg{babel} package: \begin{LaTeXdemo} % In English by default \numlist{1;2;3} \\ @@ -3062,6 +3247,15 @@ French, German, Polish and Spanish as options, and also loads the \pkg{babel} pa \numrange{1}{10} \\ \selectlanguage{spanish}% \numlist{1;2;3} \\ + \numrange{1}{10} \\ + \selectlanguage{catalan}% + \numlist{1;2;3} \\ + \numrange{1}{10} \\ + \selectlanguage{portuguese}% + \numlist{1;2;3} \\ + \numrange{1}{10} \\ + \selectlanguage{brazilian}% + \numlist{1;2;3} \\ \numrange{1}{10} \end{LaTeXdemo} @@ -3071,12 +3265,14 @@ In general, \pkg{siunitx} should be usable with other packages without interference. When the \pkg{physics} package is loaded before \pkg{siunitx}, the command -\cs{qty} is not defined: users will need to use the version~$2$ command -\cs{SI}. - -When the \pkg{units} package is loaded before \pkg{siunitx}, the command -\cs{unit} is not defined: users will need to use the version~$2$ command -\cs{si}. +\cs{qty} is not defined. Users may use the version~$2$ command \cs{SI}, +which can be used as a drop-in replacement for \cs{qty}. Alternatively, +if the \pkg{siunitx} definition is preferred, you may use +\begin{LaTeXdemo}[code only] + \AtBeginDocument{\RenewCommandCopy\qty\SI} +\end{LaTeXdemo} +and use the longer name \cs{quantity} to access the functionality of the +\pkg{physics} package. \section{Hints for using \pkg{siunitx}} @@ -3391,7 +3587,7 @@ systems: \end{LaTeXdemo} For tables, any settings that can be given before the table are only parsed once, -whereas given in the optional argument to |S| they are read in ever cell. As such, +whereas given in the optional argument to |S| they are read in every cell. As such, you should favour \begin{LaTeXdemo}[code only] \begin{table} diff --git a/macros/latex/contrib/tuda-ci/README.md b/macros/latex/contrib/tuda-ci/README.md index 57a47ad4f3..fdd1d50303 100644 --- a/macros/latex/contrib/tuda-ci/README.md +++ b/macros/latex/contrib/tuda-ci/README.md @@ -2,7 +2,7 @@ Copyright (C) Marei Peischl <marei@peitex.de>, 2018–2022 - tuda-ci 2022/04/20 v3.24 + tuda-ci 2022/04/25 v3.25 *************************************************************************** @@ -316,3 +316,6 @@ leaflets | DEMO-TUDaLeaflet.tex | tudaleaflet.cls * 3.24 (2022-04-20) - Fix paper=landscape for TUDa-SciPoster. - Improve internals for advanced department configuration in TUDa-SciPoster + * 3.25 (2022-04-25) + - Fix departmnt specific configuration mechanism in TUDa-SciPoster + - Add support for specific configuration paths diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf Binary files differindex fdac8a614e..7056169288 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf Binary files differindex 55d3cd1630..8b328ec138 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf Binary files differindex 1462ae8e3d..5ebbdbf43d 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf Binary files differindex d8b307bf6e..daecff9e1e 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf Binary files differindex 856b822011..240a9f7124 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf Binary files differindex d73e3bc8bc..0db380c6ff 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf Binary files differindex ce1a1e65d5..a3a4a9bb2a 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf Binary files differindex 7acf402ddc..baeaed7dc7 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf Binary files differindex 4a493aa297..f62cee57fe 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf Binary files differindex 1bdcef923e..f8c1ae62de 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf Binary files differindex 57a8b00154..de93725c07 100644 --- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf +++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex index e6f0d58e62..f544fec34a 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaAnnouncement.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaAnnouncement.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex index f4fae126e5..37cb9fd1d5 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaBeamer.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaBeamer.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib index 54521adc8d..0f5872b58a 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaBibliography.bib' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaBibliography.bib' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex index a9b20da8c0..36ddb7df7b 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaExercise.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaExercise.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco index 334851255a..a41081ac23 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaFromaddress.lco' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaFromaddress.lco' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex index 4879c5a239..26c273b3d5 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaLeaflet.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaLeaflet.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex index f8e053b268..12919213f4 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaLetter.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaLetter.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex index 117ca29f8a..6d9bc38e94 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaPhD.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaPhD.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex index fc15eb469d..425e463695 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaPoster.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaPoster.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex index 6fcc2db571..c98b991e8f 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaPub.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaPub.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex index 8259da2a71..595395a38c 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaReport.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaReport.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex index 02b390a449..a068bed175 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaSciPoster.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaSciPoster.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex index aad0e14013..62313cf74e 100644 --- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex +++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex @@ -1,4 +1,4 @@ -%% This is file `DEMO-TUDaThesis.tex' version 3.24 (2022/04/20), +%% This is file `DEMO-TUDaThesis.tex' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty index aac4d1091a..132e8cf1c1 100644 --- a/macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty +++ b/macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty @@ -1,4 +1,4 @@ -%% This is file `beamercolorthemeTUDa.sty' version 3.24 (2022/04/20), +%% This is file `beamercolorthemeTUDa.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{beamercolorthemeTUDa} [\filedate\space\fileversion] diff --git a/macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty index 87014da3de..aa9c89dd82 100644 --- a/macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty +++ b/macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty @@ -1,4 +1,4 @@ -%% This is file `beamerfontthemeTUDa.sty' version 3.24 (2022/04/20), +%% This is file `beamerfontthemeTUDa.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{beamerfontthemeTUDa} [\filedate\space\fileversion] diff --git a/macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty index 557789f2c6..2a194dc9ce 100644 --- a/macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty +++ b/macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty @@ -1,4 +1,4 @@ -%% This is file `beamerinnerthemeTUDa.sty' version 3.24 (2022/04/20), +%% This is file `beamerinnerthemeTUDa.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \ProvidesExplPackage{beamerinnerthemeTUDa}{\filedate}{\fileversion}{Inner~beamer~theme~of~tuda-ci} diff --git a/macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty index 56ede7ff39..985e3728cd 100644 --- a/macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty +++ b/macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty @@ -1,4 +1,4 @@ -%% This is file `beamerouterthemeTUDa.sty' version 3.24 (2022/04/20), +%% This is file `beamerouterthemeTUDa.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \ProvidesExplPackage{beamerouterthemeTUDa}{\filedate}{\fileversion}{Outer~beamer~theme~of~tuda-ci} diff --git a/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty b/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty index 1378144db5..652fc0b675 100644 --- a/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty +++ b/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty @@ -1,4 +1,4 @@ -%% This is file `beamerthemeTUDa-mecheng.sty' version 3.24 (2022/04/20), +%% This is file `beamerthemeTUDa-mecheng.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \RequirePackage{expl3} \ProvidesExplPackage{beamerthemeTUDa-mecheng}{\filedate}{\fileversion}{specific tudabeamer configuration for the department of mechanical engineering} diff --git a/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty index 0399f5ad12..308111be1f 100644 --- a/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty +++ b/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty @@ -1,4 +1,4 @@ -%% This is file `beamerthemeTUDa.sty' version 3.24 (2022/04/20), +%% This is file `beamerthemeTUDa.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{beamerthemeTUDa} [\filedate\space\fileversion\space beamer theme using the Corporate Design of TU Darmstadt] diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo index 459e08ade7..47b5a7abad 100644 --- a/macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo +++ b/macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo @@ -1,4 +1,4 @@ -%% This is file `tuda-a0paper.clo' version 3.24 (2022/04/20), +%% This is file `tuda-a0paper.clo' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \ProvidesExplFile{tuda-a0paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a0paper} \cs_set:Nn \ptxcd_setup_title_sizes: { \cs_set:Nn \ptxcd_title_fontsize: {{125pt}{165pt}} diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo index df8efa1223..0c43f25caa 100644 --- a/macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo +++ b/macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo @@ -1,4 +1,4 @@ -%% This is file `tuda-a1paper.clo' version 3.24 (2022/04/20), +%% This is file `tuda-a1paper.clo' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \ProvidesExplFile{tuda-a1paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a1paper} \cs_set:Nn \ptxcd_setup_title_sizes: { \cs_set:Nn \ptxcd_title_fontsize: {{86pt}{120pt}} diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo index 2674e388e0..175f9a85d3 100644 --- a/macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo +++ b/macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo @@ -1,4 +1,4 @@ -%% This is file `tuda-a2paper.clo' version 3.24 (2022/04/20), +%% This is file `tuda-a2paper.clo' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \ProvidesExplFile{tuda-a2paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a0paper} \cs_set:Nn \ptxcd_setup_title_sizes: { \cs_set:Nn \ptxcd_title_fontsize: {{65pt}{82pt}} diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo index 2563e1bbd5..99c2c47413 100644 --- a/macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo +++ b/macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo @@ -1,4 +1,4 @@ -%% This is file `tuda-a3paper.clo' version 3.24 (2022/04/20), +%% This is file `tuda-a3paper.clo' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \ProvidesExplFile{tuda-a3paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a3paper} \cs_set:Nn \ptxcd_setup_title_sizes: { \cs_set:Nn \ptxcd_title_fontsize: {{47pt}{61pt}} diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo index 62aeab95bb..27476d61ec 100644 --- a/macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo +++ b/macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo @@ -1,4 +1,4 @@ -%% This is file `tuda-a4paper.clo' version 3.24 (2022/04/20), +%% This is file `tuda-a4paper.clo' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \ProvidesExplFile{tuda-a4paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a4paper} \cs_set:Nn \ptxcd_setup_title_sizes: { \cs_set:Nn \ptxcd_title_fontsize: {{36pt}{47pt}} diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo index 33f1e9e7ff..53f708b477 100644 --- a/macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo +++ b/macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo @@ -1,4 +1,4 @@ -%% This is file `tuda-a5paper.clo' version 3.24 (2022/04/20), +%% This is file `tuda-a5paper.clo' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \ProvidesExplFile{tuda-a5paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a5paper} \cs_set:Nn \ptxcd_setup_title_sizes: { \cs_set:Nn \ptxcd_title_fontsize: {{22pt}{28pt}} diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty b/macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty index 49257cf899..f01dfd75b4 100644 --- a/macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty +++ b/macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty @@ -1,4 +1,4 @@ -%% This is file `tuda-pgfplots.sty' version 3.24 (2022/04/20), +%% This is file `tuda-pgfplots.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} % Special thanks to: Sebastian Schöps Institut Theorie Elektromagnetischer Felder (TEMF), TU Darmstadt % The original version of this file has been inspired by the colorscheme in the Metropolis beamer theme by Matthias Vogelgesang https://github.com/matze/mtheme \ProvidesPackage{tuda-pgfplots}[\filedate\space\fileversion\space tuda-ci pgfplots color schemes] diff --git a/macros/latex/contrib/tuda-ci/tex/tudabeamer.cls b/macros/latex/contrib/tuda-ci/tex/tudabeamer.cls index 54a7f37f6a..3d88725bf2 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudabeamer.cls +++ b/macros/latex/contrib/tuda-ci/tex/tudabeamer.cls @@ -1,4 +1,4 @@ -%% This is file `tudabeamer.cls' version 3.24 (2022/04/20), +%% This is file `tudabeamer.cls' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{tudabeamer} [\filedate\space\fileversion\space] @@ -66,6 +66,11 @@ \str_gset:Nn \g_ptxcd_department_str {mecheng} }, department .initial:n = default, + department / unknown .code:n = { + \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} + }, + departmentconfigprefix .tl_gset:N = \g__ptxcd_config_prefix_tl, + departmentconfigprefix .initial:n = , mecheng .meta:n = {department=mecheng}, departmentlogofile .tl_gset:N = \g_ptxcd_departmentlogo_tl, departmentlogofile .initial:n =, @@ -217,7 +222,8 @@ \@input{\jobname.len}% \@starttoc{len}% \let\accentfont\normalfont% -\file_if_exist:nT {beamerthemeTUDa-\g_ptxcd_department_str.sty} {\usetheme{TUDa-\g_ptxcd_department_str}} + +\file_if_exist:nT {\g__ptxcd_config_prefix_tl beamerthemeTUDa-\g_ptxcd_department_str.sty} {\usetheme{\g__ptxcd_config_prefix_tl TUDa-\g_ptxcd_department_str}} \ExplSyntaxOff diff --git a/macros/latex/contrib/tuda-ci/tex/tudacolors.def b/macros/latex/contrib/tuda-ci/tex/tudacolors.def index 9b2af62e64..3588daa7de 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudacolors.def +++ b/macros/latex/contrib/tuda-ci/tex/tudacolors.def @@ -1,4 +1,4 @@ -%% This is file `tudacolors.def' version 3.24 (2022/04/20), +%% This is file `tudacolors.def' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \ProvidesFile{tudacolors.def} [\filedate\space\fileversion\space Color definitions for tuda-ci] diff --git a/macros/latex/contrib/tuda-ci/tex/tudacolors.sty b/macros/latex/contrib/tuda-ci/tex/tudacolors.sty index 71e5dc0911..702fe20837 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudacolors.sty +++ b/macros/latex/contrib/tuda-ci/tex/tudacolors.sty @@ -1,4 +1,4 @@ -%% This is file `tudacolors.sty' version 3.24 (2022/04/20), +%% This is file `tudacolors.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplPackage{tudacolors}{\filedate}{\fileversion}{Color definition for TU Darmstadt's tuda-ci bundle} @@ -64,7 +64,6 @@ department / unknown .code:n = { \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} }, - department .initial:V = \g_ptxcd_department_str, mecheng .meta:n = {department=mecheng}, } @@ -102,34 +101,36 @@ \msg_new:nnnn{tudacolors} {undefined-color} {The~ color~ #1~ you~ selected~ is~ not~ defined.} {See~ the~ tuda-ci~ manual~ for~ a~ list~ of~ available~ colors.} \msg_new:nnnn{tudacolors} {unselectable-color} {The~ color~ you~ selected~ (#1)~ must~ not~ be~ choosen~ for~ #2.} {See~ the~ Corporate~ Design~ Guidelines~ for~ further~ information.} -%select accentcolor -\exp_args:Nnx \colorlet{accentcolor}{\g_ptxcd_color_accent_tl} -\bool_if:NTF \g_ptxcd_color_whitetext_bool { - \clist_if_in:NVTF \c_ptxcd_color_allow_whitetext_clist \g_ptxcd_color_accent_tl { - \colorlet{textonaccentcolor}{white} +\hook_new:n {ptxcd/init-colors} +\hook_gput_code:nnn {ptxcd/init-colors} {tudacolors} { + \exp_args:Nnx \colorlet{accentcolor}{\g_ptxcd_color_accent_tl} + \bool_if:NTF \g_ptxcd_color_whitetext_bool { + \clist_if_in:NVTF \c_ptxcd_color_allow_whitetext_clist \g_ptxcd_color_accent_tl { + \colorlet{textonaccentcolor}{white} + } { + \colorlet{textonaccentcolor}{black} + \tl_if_in:NnT \g_ptxcd_color_accent_tl {TUDa} {\msg_warning:nnxx{tudacolors} {unselectable-color} {white} {textonaccentcolor}} + } } { - \colorlet{textonaccentcolor}{black} - \tl_if_in:NnT \g_ptxcd_color_accent_tl {TUDa} {\msg_warning:nnxx{tudacolors} {unselectable-color} {white} {textonaccentcolor}} + \clist_if_in:NVTF \c_ptxcd_color_allow_blacktext_clist \g_ptxcd_color_accent_tl { + \colorlet{textonaccentcolor}{black} + } { + \colorlet{textonaccentcolor}{white} + \tl_if_in:NnT \g_ptxcd_color_accent_tl {TUDa} {msg_warning:nnxx{tudacolors} {unselectable-color} {black} {textonaccentcolor}} + } } -} { - \clist_if_in:NVTF \c_ptxcd_color_allow_blacktext_clist \g_ptxcd_color_accent_tl { - \colorlet{textonaccentcolor}{black} + \colorlet{identbarcolor}{\g_ptxcd_color_identbar_tl} + \exp_args:NNx \clist_if_in:NnTF \c_ptxcd_color_forbid_textaccent_clist {\g_ptxcd_color_textaccent_tl} { + \msg_warning:nnxx{tudacolors} {unselectable-color} {\g_ptxcd_color_textaccent_tl} {textaccentcolor} + \colorlet{textaccentcolor}{black} } { - \colorlet{textonaccentcolor}{white} - \tl_if_in:NnT \g_ptxcd_color_accent_tl {TUDa} {msg_warning:nnxx{tudacolors} {unselectable-color} {black} {textonaccentcolor}} + \colorlet{textaccentcolor}{\g_ptxcd_color_textaccent_tl} } } -\colorlet{identbarcolor}{\g_ptxcd_color_identbar_tl} +\hook_use:n {ptxcd/init-colors} -\exp_args:NNx \clist_if_in:NnTF \c_ptxcd_color_forbid_textaccent_clist {\g_ptxcd_color_textaccent_tl} { - \msg_warning:nnxx{tudacolors} {unselectable-color} {\g_ptxcd_color_textaccent_tl} {textaccentcolor} - \colorlet{textaccentcolor}{black} -} { - \colorlet{textaccentcolor}{\g_ptxcd_color_textaccent_tl} -} - \colorlet{InfoBox}{white} \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls b/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls index 01c0a0f908..f9a7e79acb 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls +++ b/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls @@ -1,4 +1,4 @@ -%% This is file `tudaexercise.cls' version 3.24 (2022/04/20), +%% This is file `tudaexercise.cls' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplClass{tudaexercise} @@ -183,6 +183,11 @@ \keys_set:nn {ptxcd/exercise}{colorback=false,departmentlogofile=tuda_maschinenbau_logo,color=Primary1} }, department .initial:n = default, + department / unknown .code:n = { + \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} + }, + departmentconfigprefix .tl_gset:N = \g__ptxcd_config_prefix_tl, + departmentconfigprefix .initial:n = tuda, mecheng .meta:n = {department=mecheng}, departmentlogofile .tl_gset:N = \g_ptxcd_departmentlogo_tl, departmentlogofile .initial:n =, @@ -913,7 +918,7 @@ \cs_set_eq:NN \thesubtask \thesubsection } -\file_if_exist_input:n {tuda\g_ptxcd_department_str.cfg} +\file_if_exist_input:n {\g__ptxcd_config_prefix_tl\g_ptxcd_department_str.cfg} \ptxcd_makeheadrule[color=identbarcolor, width=\textwidth]{ptxcd_headrule} diff --git a/macros/latex/contrib/tuda-ci/tex/tudafonts.sty b/macros/latex/contrib/tuda-ci/tex/tudafonts.sty index 255637f835..ede90bcaf9 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudafonts.sty +++ b/macros/latex/contrib/tuda-ci/tex/tudafonts.sty @@ -1,4 +1,4 @@ -%% This is file `tudafonts.sty' version 3.24 (2022/04/20), +%% This is file `tudafonts.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{tudafonts} [\filedate\space\fileversion\space diff --git a/macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls b/macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls index 77629e07ee..81d7cbe91f 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls +++ b/macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls @@ -1,4 +1,4 @@ -%% This is file `tudaleaflet.cls' version 3.24 (2022/04/20), +%% This is file `tudaleaflet.cls' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplPackage{tudaleaflet}{\filedate}{\fileversion}{Leaflets using the Corporate Design of TU Darmstadt} @@ -62,6 +62,11 @@ \keys_set:nn {ptxcd/leaflet} {colorback=false, departmentlogofile=tuda_maschinenbau_logo} }, department .initial:n = default, + department / unknown .code:n = { + \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} + }, + departmentconfigprefix .tl_gset:N = \g__ptxcd_config_prefix_tl, + departmentconfigprefix .initial:n = tuda, mecheng .meta:n = {department=mecheng}, departmentlogofile .tl_gset:N = \g_ptxcd_departmentlogo_tl, departmentlogofile .initial:n =, @@ -438,7 +443,7 @@ contents={ } } -\file_if_exist_input:n {tuda\g_ptxcd_department_str.cfg} +\file_if_exist_input:n {\g__ptxcd_config_prefix_tl\g_ptxcd_department_str.cfg} \ptxcd_makeheadrule[color=identbarcolor]{ptxcd_headrule} \ptxcd_makefootrule{ptxcd_footrule} diff --git a/macros/latex/contrib/tuda-ci/tex/tudaletter.cls b/macros/latex/contrib/tuda-ci/tex/tudaletter.cls index 4bcfef164c..10496eb8e5 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudaletter.cls +++ b/macros/latex/contrib/tuda-ci/tex/tudaletter.cls @@ -1,4 +1,4 @@ -%% This is file `tudaletter.cls' version 3.24 (2022/04/20), +%% This is file `tudaletter.cls' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplClass{tudaletter} @@ -61,6 +61,11 @@ \PassOptionsToPackage{identbar=Primary1,accent=Primary2}{tudacolors} }, department .initial:n = default, + department / unknown .code:n = { + \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} + }, + departmentconfigprefix .tl_gset:N = \g__ptxcd_config_prefix_tl, + departmentconfigprefix .initial:n = tuda, mecheng .meta:n = {department=mecheng}, departmentlogofile .tl_gset:N = \g_ptxcd_departmentlogo_tl, departmentlogofile .initial:n =, @@ -515,5 +520,5 @@ \let\Ifkomavarempty\ifkomavarempty } -\file_if_exist_input:n {tuda\g_ptxcd_department_str.cfg} +\file_if_exist_input:n {\g__ptxcd_config_prefix_tl\g_ptxcd_department_str.cfg} \endinput diff --git a/macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo b/macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo index 221c677efb..d56d236cc2 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo +++ b/macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo @@ -1,4 +1,4 @@ -%% This is file `tudalettersize10pt.clo' version 3.24 (2022/04/20), +%% This is file `tudalettersize10pt.clo' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg b/macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg index 1bf9dc2ee9..04b485e666 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg +++ b/macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg @@ -1,4 +1,4 @@ -%% This is file `tudamecheng.cfg' version 3.24 (2022/04/20), +%% This is file `tudamecheng.cfg' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,14 +26,16 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \RequirePackage{expl3} \ProvidesExplFile{tudamecheng.cfg} {\filedate}{\fileversion}{Special Features the department of mechanical engineering of Darmstadt's Corporate Design (tuda-ci)} \RequirePackage{pgf} +\keys_set:nn {ptxcd/colors}{accent=TUDa-2d,identbar=TUDa-6b} + \cs_new:Nn \ptxcd_mecheng_arrow:N { \begin{pgfpicture} \pgfsetbaseline{0} diff --git a/macros/latex/contrib/tuda-ci/tex/tudaposter.cls b/macros/latex/contrib/tuda-ci/tex/tudaposter.cls index 23ce7e27bd..56c7210097 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudaposter.cls +++ b/macros/latex/contrib/tuda-ci/tex/tudaposter.cls @@ -1,4 +1,4 @@ -%% This is file `tudaposter.cls' version 3.24 (2022/04/20), +%% This is file `tudaposter.cls' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplPackage{tudaposter}{\filedate}{\fileversion}{Poster Layouts for the Corporate Design of TU Darmstadt} @@ -107,6 +107,11 @@ \keys_set:nn {ptxcd/poster} {colorback=false, departmentlogofile=tuda_maschinenbau_logo} }, department .initial:n = default, + department / unknown .code:n = { + \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} + }, + departmentconfigprefix .tl_gset:N = \g__ptxcd_config_prefix_tl, + departmentconfigprefix .initial:n = tuda, mecheng .meta:n = {department=mecheng}, departmentlogofile .tl_gset:N = \g_ptxcd_departmentlogo_tl, departmentlogofile .initial:n =, @@ -607,7 +612,7 @@ \textsuperscript{#1}#2 } -\file_if_exist_input:n {tuda\g_ptxcd_department_str.cfg} +\file_if_exist_input:n {\g__ptxcd_config_prefix_tl\g_ptxcd_department_str.cfg} \endinput diff --git a/macros/latex/contrib/tuda-ci/tex/tudapub.cls b/macros/latex/contrib/tuda-ci/tex/tudapub.cls index 7f2305e9d7..9425b47db6 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudapub.cls +++ b/macros/latex/contrib/tuda-ci/tex/tudapub.cls @@ -1,4 +1,4 @@ -%% This is file `tudapub.cls' version 3.24 (2022/04/20), +%% This is file `tudapub.cls' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplClass{tudapub} @@ -177,6 +177,8 @@ department / unknown .code:n = { \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} }, + departmentconfigprefix .tl_gset:N = \g__ptxcd_config_prefix_tl, + departmentconfigprefix .initial:n = tuda, mecheng .meta:n = {department=mecheng}, departmentlogofile .tl_gset:N = \g_ptxcd_departmentlogo_tl, departmentlogofile .initial:n =, @@ -1373,6 +1375,6 @@ \let\Iftocfeature\iftocfeature } -\file_if_exist_input:n {tuda\g_ptxcd_department_str.cfg} +\file_if_exist_input:n {\g__ptxcd_config_prefix_tl\g_ptxcd_department_str.cfg} \endinput %End of class tudapub.cls diff --git a/macros/latex/contrib/tuda-ci/tex/tudarules.sty b/macros/latex/contrib/tuda-ci/tex/tudarules.sty index db42809f7b..6dd216bdab 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudarules.sty +++ b/macros/latex/contrib/tuda-ci/tex/tudarules.sty @@ -1,4 +1,4 @@ -%% This is file `tudarules.sty' version 3.24 (2022/04/20), +%% This is file `tudarules.sty' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplPackage{tudarules}{\filedate}{\fileversion}{Creation of colored bars for tuda-ci bundle} @@ -84,7 +84,6 @@ department / unknown .code:n = { \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} }, - department .initial:V = \g_ptxcd_department_str, mecheng .meta:n = {department=mecheng}, } diff --git a/macros/latex/contrib/tuda-ci/tex/tudasciposter.cls b/macros/latex/contrib/tuda-ci/tex/tudasciposter.cls index e70cc21a76..d922742fe4 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudasciposter.cls +++ b/macros/latex/contrib/tuda-ci/tex/tudasciposter.cls @@ -1,4 +1,4 @@ -%% This is file `tudasciposter.cls' version 3.24 (2022/04/20), +%% This is file `tudasciposter.cls' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplPackage{tudasciposter}{\filedate}{\fileversion}{Scientific Poster Layout for TU Darmstadt} @@ -85,6 +85,11 @@ \keys_set:nn {ptxcd/poster} {colorback=false, departmentlogofile=tuda_maschinenbau_logo,titlesepline=false} }, department .initial:n = default, + department / unknown .code:n = { + \str_gset:Nx \g_ptxcd_department_str {\l_keys_value_tl} + },, + departmentconfigprefix .tl_gset:N = \g__ptxcd_config_prefix_tl, + departmentconfigprefix .initial:n = tuda, mecheng .meta:n = {department=mecheng}, departmentlogofile .tl_gset:N = \g_ptxcd_departmentlogo_tl, departmentlogofile .initial:n =, @@ -164,11 +169,6 @@ \box_new:N \g_ptxcd_author_box \box_new:N \g_ptxcd_credit_box -\ptxcd_makeheadrule[ - width=\paperwidth-2\g_ptxcd_margin_dim, - color=identbarcolor - ]{ptxcd_headrule} - \tl_new:N \g_ptxcd_thanks_tl \newcommand*{\ptxcd_title@footnote}[2][1]{ \begingroup @@ -468,23 +468,26 @@ }; } +\hook_gput_code:nnn {ptxcd/init-colors} {tudasciposter} { + \bool_if:NTF \g_ptxcd_colorback_bool + {\colorlet{titlefgcolor}{textonaccentcolor}} + {\colorlet{titlefgcolor}{black}} + \colorlet{titlebgcolor}{accentcolor} + % Block Colors + \colorlet{blocktitlebgcolor}{accentcolor} + \colorlet{blocktitlefgcolor}{textonaccentcolor} + % Innerblock Colors + \colorlet{innerblockbodybgcolor}{textonaccentcolor} +} % Background Colors \colorlet{backgroundcolor}{white} \colorlet{framecolor}{white} -% Title Colors -\bool_if:NTF \g_ptxcd_colorback_bool - {\colorlet{titlefgcolor}{textonaccentcolor}} - {\colorlet{titlefgcolor}{black}} -\colorlet{titlebgcolor}{accentcolor} % Block Colors -\colorlet{blocktitlebgcolor}{accentcolor} -\colorlet{blocktitlefgcolor}{textonaccentcolor} \colorlet{blockbodybgcolor}{white} \colorlet{blockbodyfgcolor}{black} % Innerblock Colors \colorlet{innerblocktitlebgcolor}{black!15} \colorlet{innerblocktitlefgcolor}{black} -\colorlet{innerblockbodybgcolor}{textonaccentcolor} \colorlet{innerblockbodyfgcolor}{black} \dim_new:N \g_ptxcd_titleblock_dim @@ -619,10 +622,17 @@ every~ box~ on~ layer~ 4/.style={reset,\g_ptxcd_boxstyle_tl -inner}, } -%ADjust caption indent +%Adjust caption indent \setcapindent{1em} -\file_if_exist_input:n {tuda\g_ptxcd_department_str.cfg} +\file_if_exist_input:n {\g__ptxcd_config_prefix_tl\g_ptxcd_department_str.cfg} + +\hook_use:n {ptxcd/init-colors} + +\ptxcd_makeheadrule[ + width=\paperwidth-2\g_ptxcd_margin_dim, + color=identbarcolor +]{ptxcd_headrule} \endinput %end of tudasciposter.cls diff --git a/macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo b/macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo index 0cb0cd1d2c..a8dc5a4fdc 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo +++ b/macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo @@ -1,4 +1,4 @@ -%% This is file `tudasize9pt.clo' version 3.24 (2022/04/20), +%% This is file `tudasize9pt.clo' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/tuda-ci/tex/tudathesis.cfg b/macros/latex/contrib/tuda-ci/tex/tudathesis.cfg index c635933f64..227e21943a 100644 --- a/macros/latex/contrib/tuda-ci/tex/tudathesis.cfg +++ b/macros/latex/contrib/tuda-ci/tex/tudathesis.cfg @@ -1,4 +1,4 @@ -%% This is file `tudathesis.cfg' version 3.24 (2022/04/20), +%% This is file `tudathesis.cfg' version 3.25 (2022/04/25), %% it is part of %% TUDa-CI -- Corporate Design for TU Darmstadt %% ---------------------------------------------------------------------------- @@ -26,8 +26,8 @@ %% %% ============================================================================ %% -\def\fileversion{3.24} -\def\filedate{2022/04/20} +\def\fileversion{3.25} +\def\filedate{2022/04/25} \RequirePackage{expl3} \ProvidesExplFile{tudathesis.cfg} {\filedate}{\fileversion}{Special Features for publication type 'thesis' using TU Darmstadt's Corporate Design (tuda-ci)} |