diff options
Diffstat (limited to 'macros/latex/contrib/joinbox/joinbox.sty')
-rw-r--r-- | macros/latex/contrib/joinbox/joinbox.sty | 94 |
1 files changed, 57 insertions, 37 deletions
diff --git a/macros/latex/contrib/joinbox/joinbox.sty b/macros/latex/contrib/joinbox/joinbox.sty index 06077c23f1..68e54c3a20 100644 --- a/macros/latex/contrib/joinbox/joinbox.sty +++ b/macros/latex/contrib/joinbox/joinbox.sty @@ -7,7 +7,7 @@ \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\ProvidesExplPackage{joinbox}{2023-08-21}{v1.0.2} +\ProvidesExplPackage{joinbox}{2024-09-09}{v1.0.3} {Join figures to same height or width with LaTeX3} \RequirePackage{xparse} @@ -42,7 +42,6 @@ % 函数变体 \cs_generate_variant:Nn \hcoffin_set:Nn { Nx } - % 定义变量 \bool_new:N \l__joinbox_vertical_bool \bool_new:N \l__joinbox_out_scale_bool @@ -77,7 +76,8 @@ baseline .value_required:n = true, baseline .choices:nn = { t, vc, H, b } { - \int_set_eq:NN \l__joinbox_baseline_int \l_keys_choice_int + \int_set_eq:NN \l__joinbox_baseline_int + \l_keys_choice_int }, baseline .default:n = vc, baseline .initial:n = b, @@ -92,19 +92,19 @@ \bool_set_false:N \l__joinbox_out_scale_bool }{ \bool_set_true:N \l__joinbox_out_scale_bool - \dim_set:Nn \l__joinbox_out_length_dim { \dim_eval:n{ #1 } } + \dim_set:Nn \l__joinbox_out_length_dim + { \dim_eval:n{ #1 } } } } }, outlen .default:n = 0pt, outlen .initial:n = 0pt, - % 拼音间距 + % 拼接间距 sep .dim_set:N = \l__joinbox_sep_dim, sep .default:n = 0pt, sep .initial:n = 0pt, - % unknown .code:n = { \__joinbox_error:n { unknown-option } } unknown .code:n = \__joinbox_unknown_key:V \l_keys_key_str, } @@ -116,8 +116,7 @@ { vc } { \int_set:Nn \l__joinbox_baseline_int { 2 } } { H } { \int_set:Nn \l__joinbox_baseline_int { 3 } } { b } { \int_set:Nn \l__joinbox_baseline_int { 4 } } - } - { + }{ % 转换为token \tl_set_rescan:Nnn \l_tmpa_tl {} {#1} % 计算尺寸 @@ -138,12 +137,9 @@ } \cs_generate_variant:Nn \__joinbox_unknown_key:n { V } -% \msg_new:nnn { joinbox } { unknown-option } -% { package~ option~ "\l_keys_key_tl"~ is~ unknown. } - %% 参数设置用户接口 \NewDocumentCommand \joinset { m } - { \keys_set:nn { joinset } {#1} } + { \keys_set:nn { joinbox } {#1} } % 计算box盒子的总高度 % #1---盒子变量 @@ -208,7 +204,8 @@ \dim_set_eq:NN \l__joinbox_min_height_dim \l_tmpb_dim } - \bool_if:nT { !(\l__joinbox_only_first_bool) && !(\l__joinbox_only_second_bool) } + \bool_if:nT { !(\l__joinbox_only_first_bool) && + !(\l__joinbox_only_second_bool) } { % 比较并记录最小宽度 \dim_set:Nn \l__joinbox_min_width_dim @@ -274,10 +271,12 @@ { \coffin_scale:Nnn \l__joinbox_out_coffin { - \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_out_coffin } + \dim_ratio:nn { \l__joinbox_min_width_dim } + { \coffin_wd:N \l__joinbox_out_coffin } } { - \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_out_coffin } + \dim_ratio:nn { \l__joinbox_min_width_dim } + { \coffin_wd:N \l__joinbox_out_coffin } } } @@ -286,10 +285,12 @@ { \coffin_scale:Nnn \l__joinbox_tmpa_coffin { - \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_min_width_dim } + { \coffin_wd:N \l__joinbox_tmpa_coffin } } { - \dim_ratio:nn { \l__joinbox_min_width_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_min_width_dim } + { \coffin_wd:N \l__joinbox_tmpa_coffin } } } @@ -298,11 +299,13 @@ \coffin_set_eq:NN \l__joinbox_out_coffin \l__joinbox_tmpa_coffin } - \bool_if:nT { !(\l__joinbox_only_first_bool) && !(\l__joinbox_only_second_bool) } + \bool_if:nT { !(\l__joinbox_only_first_bool) && + !(\l__joinbox_only_second_bool) } { % 将第2个盒子拼接到第一个盒子 \coffin_join:NnnNnnnn \l__joinbox_out_coffin - { hc } { b } \l__joinbox_tmpa_coffin { hc } { t } { 0pt } { -\l__joinbox_sep_dim } + { hc } { b } \l__joinbox_tmpa_coffin { hc } { t } + { 0pt } { -\l__joinbox_sep_dim } } % 按指定输出宽度缩放输出盒子 @@ -310,10 +313,12 @@ { \coffin_scale:Nnn \l__joinbox_out_coffin { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \l__joinbox_min_width_dim } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \l__joinbox_min_width_dim } } { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \l__joinbox_min_width_dim } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \l__joinbox_min_width_dim } } } @@ -329,10 +334,12 @@ % 按最小高度缩放第1个盒子 \coffin_scale:Nnn \l__joinbox_out_coffin { - \dim_ratio:nn { \l__joinbox_min_height_dim }{ \__joinbox_coffin_ht_plus_dp:N \l__joinbox_out_coffin } + \dim_ratio:nn { \l__joinbox_min_height_dim } + { \__joinbox_coffin_ht_plus_dp:N \l__joinbox_out_coffin } } { - \dim_ratio:nn { \l__joinbox_min_height_dim }{ \__joinbox_coffin_ht_plus_dp:N \l__joinbox_out_coffin } + \dim_ratio:nn { \l__joinbox_min_height_dim } + { \__joinbox_coffin_ht_plus_dp:N \l__joinbox_out_coffin } } % 处理第2个盒子 @@ -344,25 +351,30 @@ % 按最小高度缩放第2个盒子 \coffin_scale:Nnn \l__joinbox_tmpa_coffin { - \dim_ratio:nn { \l__joinbox_min_height_dim }{ \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_min_height_dim } + { \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } } { - \dim_ratio:nn { \l__joinbox_min_height_dim }{ \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_min_height_dim } + { \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } } % 将第2个盒子拼接到第1个盒子 \coffin_join:NnnNnnnn \l__joinbox_out_coffin - { vc } { r } \l__joinbox_tmpa_coffin { vc } { l } { \l__joinbox_sep_dim } { 0pt } + { vc } { r } \l__joinbox_tmpa_coffin { vc } { l } + { \l__joinbox_sep_dim } { 0pt } % 按指定输出高度缩放输出盒子 \bool_if:NT \l__joinbox_out_scale_bool { \coffin_scale:Nnn \l__joinbox_out_coffin { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \l__joinbox_min_height_dim } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \l__joinbox_min_height_dim } } { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \l__joinbox_min_height_dim } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \l__joinbox_min_height_dim } } } @@ -425,19 +437,23 @@ { \coffin_scale:Nnn \l__joinbox_tmpa_coffin { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \coffin_wd:N \l__joinbox_tmpa_coffin } } { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \coffin_wd:N \l__joinbox_tmpa_coffin } } } { \coffin_scale:Nnn \l__joinbox_tmpa_coffin { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } } { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } } } } @@ -491,19 +507,23 @@ { \coffin_scale:Nnn \l__joinbox_tmpa_coffin { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \coffin_wd:N \l__joinbox_tmpa_coffin } } { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \coffin_wd:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \coffin_wd:N \l__joinbox_tmpa_coffin } } } { \coffin_scale:Nnn \l__joinbox_tmpa_coffin { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } } { - \dim_ratio:nn { \l__joinbox_out_length_dim }{ \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } + \dim_ratio:nn { \l__joinbox_out_length_dim } + { \__joinbox_coffin_ht_plus_dp:N \l__joinbox_tmpa_coffin } } } } @@ -595,7 +615,7 @@ % 被拼接对象同时为空,无需拼接 \msg_new:nnn { joinbox } { empty-objs } - { The~two~objects~which~was~joined~are~empty. } + { The~two~objects~which~were~joined~are~empty. } % 图像拼接用户接口 % 将指定文件名列表中的图像拼接成一个盒子 |