diff options
author | Norbert Preining <norbert@preining.info> | 2022-04-28 03:00:36 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-04-28 03:00:36 +0000 |
commit | af956ba2c2710e269fb7eed018809aa08da5bd40 (patch) | |
tree | 3ed5a80d5289aacb738f16b31cb7c7c98eccb17b /macros | |
parent | 7b9369df36adafdc30953d0c1582dc2cd47bc1b4 (diff) |
CTAN sync 202204280300
Diffstat (limited to 'macros')
20 files changed, 709 insertions, 490 deletions
diff --git a/macros/latex/contrib/circledtext/circledtext.pdf b/macros/latex/contrib/circledtext/circledtext.pdf Binary files differindex aa7369ad60..63396e64fc 100644 --- a/macros/latex/contrib/circledtext/circledtext.pdf +++ b/macros/latex/contrib/circledtext/circledtext.pdf diff --git a/macros/latex/contrib/circledtext/circledtext.sty b/macros/latex/contrib/circledtext/circledtext.sty index d8f125043f..f70b716814 100644 --- a/macros/latex/contrib/circledtext/circledtext.sty +++ b/macros/latex/contrib/circledtext/circledtext.sty @@ -19,7 +19,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{expl3} -\ProvidesExplPackage{circledtext}{2022-04-24}{v1.0.0} +\ProvidesExplPackage{circledtext}{2022-04-28}{v1.1.0} {Typeset circled text with l3draw} \RequirePackage { xtemplate, l3keys2e, l3draw, xparse } @@ -109,10 +109,16 @@ % 字符(串)的字形类型(实线、虚线等) \int_new:N \l__circledtext_charstroke_type_int +% 字体自身缩放比例 +\fp_new:N \l__circledtext_char_shrink_fp + % 填充色辅助函数 \cs_new_nopar:Nn \__circledtext_aux_color_boxfill: { } +% 盒子由l3draw实现, +% 设计思路和部分源码来自zitie宏包(\url{https://www.ctan.org/pkg/zitie})。 + % 颜色命名函数 % #1 颜色名称 % #2 颜色表达式 @@ -244,8 +250,67 @@ % 无边框 \__circledtext_new_char_box_construct:nn { none } { } -% 实心正方形 -\__circledtext_new_char_box_construct:nn { filledsquare } +% 填充正方形 +\__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 } + } + \draw_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 } + \draw_path_rectangle:nn { #1, #2 } { #3*#5, #4*#6 } + \draw_path_use_clear:n { fill } + \draw_scope_end: + } + } + +% 反色填充正方形 +\__circledtext_new_char_box_construct:nn { __negfilledsquare } + { + \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 { circledtextboxfill } + }{ + \color_fill:n { circledtextcharcolor } + } + \draw_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 } + \draw_path_rectangle:nn { #1, #2 } { #3*#5, #4*#6 } + \draw_path_use_clear:n { fill } + \draw_scope_end: + } + } + +% 正方形填充内切圆 +\__circledtext_new_char_box_construct:nn { __innerfilledcircle } + { + \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 } + } + \draw_path_circle:nn { #3/2, #4/2 } { #3*#5/2 } + \draw_path_use_clear:n { fill } + \draw_scope_end: + } + } + +% 正方形填充外接圆 +\__circledtext_new_char_box_construct:nn { __outerfilledcircle } { \cs_if_eq:NNF \__circledtext_aux_color_boxfill: \c_empty_tl { @@ -257,25 +322,47 @@ }{ \color_fill:n { circledtextboxfill } } - % \color_fill:n { circledtextboxfill } - \draw_path_rectangle:nn { #1, #2 } { #3, #4 } + \draw_path_circle:nn { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 } \draw_path_use_clear:n { fill } \draw_scope_end: } } -% 外框正方形 -\__circledtext_new_char_box_construct:nn { boxsquare } +% 正方形边框 +\__circledtext_new_char_box_construct:nn { __squarebox } + { + \draw_scope_begin: + \color_stroke:n { circledtextcharboxcolor } + \draw_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 } + \draw_path_rectangle:nn { #1, #2 } { #3*#5, #4*#6 } + \draw_path_use_clear:n { stroke } + \draw_scope_end: + } + +% 正方形内切圆边框 +\__circledtext_new_char_box_construct:nn { __innercirclebox } + { + \__circledtext_aux_color_boxfill: + \draw_scope_begin: + \color_stroke:n { circledtextcharboxcolor } + \draw_path_circle:nn { #3/2, #4/2 } { #3*#5/2 } + \draw_path_use_clear:n { stroke } + \draw_scope_end: + } + +% 正方形外接圆边框 +\__circledtext_new_char_box_construct:nn { __outercirclebox } { \draw_scope_begin: \color_stroke:n { circledtextcharboxcolor } - \draw_path_rectangle:nn { #1, #2 } { #3, #4 } + \draw_path_circle:nn { #3/2, #4/2 } + { \l__circledtext_char_box_radius_dim*#5 } \draw_path_use_clear:n { stroke } \draw_scope_end: } -% 正方形对角十字线 -\__circledtext_new_char_box_construct:nn { dcrosssquare } +% 正方形斜十字线(正方形对角连线) +\__circledtext_new_char_box_construct:nn { __dcross } { \draw_scope_begin: \tl_if_empty:NF \l__circledtext_dash_pattern_tl @@ -284,16 +371,17 @@ } \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_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 } + \draw_path_moveto:n { #1 , #2 } + \draw_path_lineto:n { #3*#5, #4*#6 } + \draw_path_moveto:n { #1 , #4*#6 } + \draw_path_lineto:n { #3 , #2*#5 } \draw_path_use_clear:n { stroke } \draw_scope_end: } -% 对角十字线 -\__circledtext_new_char_box_construct:nn { crosssquare } +% 正方形正十字线(正方形对边中点连线) +\__circledtext_new_char_box_construct:nn { __scross } { \draw_scope_begin: \tl_if_empty:NF \l__circledtext_dash_pattern_tl @@ -302,50 +390,63 @@ } \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_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 } + \draw_path_moveto:n { #3*#5/2, #2 } + \draw_path_lineto:n { #3*#5/2, #4*#6 } + \draw_path_moveto:n { #1 , #4*#6/2 } + \draw_path_lineto:n { #3*#5 , #4*#6/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 } +% 内切圆斜十字线(需要求交点) +\__circledtext_new_char_box_construct:nn { __innerdcross } { \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 } + \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 + { #1, #2 } % line's first point + { #3, #4 } % line's second point + { #3/2, #4/2 } { #3*#5/2 } + {1} % index of intersect + } + \draw_path_lineto:n + { + \draw_point_intersect_line_circle:nnnnn + { #1, #2 } % line's first point + { #3, #4 } % line's second point + { #3/2, #4/2 } { #3*#5/2 } + {2} % index of intersect + } + \draw_path_moveto:n + { + \draw_point_intersect_line_circle:nnnnn + { #1, #4 } % line's first point + { #3, #2 } % line's second point + { #3/2, #4/2 } { #3*#5/2 } + {1} % index of intersect + } + \draw_path_lineto:n + { + \draw_point_intersect_line_circle:nnnnn + { #1, #4 } % line's first point + { #3, #2 } % line's second point + { #3/2, #4/2 } { #3*#5/2 } + {2} % index of intersect + } \draw_path_use_clear:n { stroke } \draw_scope_end: } -% 十字线 -\__circledtext_new_char_box_construct:nn { cross } +% 外接圆正十字线(需要求交点) +\__circledtext_new_char_box_construct:nn { __outercross } { \draw_scope_begin: \tl_if_empty:NF \l__circledtext_dash_pattern_tl @@ -359,8 +460,7 @@ \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 } + { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 } {1} % index of intersect } \draw_path_lineto:n @@ -368,8 +468,7 @@ \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 } + { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 } {2} % index of intersect } \draw_path_moveto:n @@ -377,8 +476,7 @@ \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 } + { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 } {1} % index of intersect } \draw_path_lineto:n @@ -386,110 +484,114 @@ \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 } + { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 } {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_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innercirclebox } {#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_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innercirclebox } {#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_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innerdcross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innercirclebox } {#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_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innerdcross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {#5} {#6} } -% 带边框实心正方形 -\__circledtext_new_char_box_construct:nn { O } +% 内切圆斜十字线叠加正十字线 +\__circledtext_new_char_box_construct:nn { x+ } { - \__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_char_box_type_c:n { __innerdcross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6} } -% 正方形米字线 -\__circledtext_new_char_box_construct:nn { X+ } +% 填充正方形叠加正方形边框 +\__circledtext_new_char_box_construct:nn { O } { - \__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 { __filledsquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __squarebox } {#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_char_box_type_c:n { __filledsquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __squarebox } {#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_char_box_type_c:n { __filledsquare } {#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 { __squarebox } {#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} + \__circledtext_char_box_type_c:n { __filledsquare } {#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 { __scross } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 正方形斜十字线叠加正十字线 +\__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 { __scross } {#1} {#2} {#3} {#4} {#5} {#6} + } + +% 内切圆叠加同心82%内切圆边框 +\__circledtext_new_char_box_construct:nn { oo } + { + \__circledtext_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {0.82} {0.82} + } + +% 反色正方形叠加内切填充圆 +\__circledtext_new_char_box_construct:nn { Oo } + { + \__circledtext_char_box_type_c:n { __negfilledsquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6} } +% 正方形叠加同心82%正方形边框 +\__circledtext_new_char_box_construct:nn { OO } + { + \__circledtext_char_box_type_c:n { __filledsquare } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6} + \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {0.82} {0.82} + } \msg_new:nnn { circledtext } { box-exists } { The~ box~ type~ `#1~ not~ exists. } % 缩放类型名称生成函数 @@ -690,6 +792,7 @@ charf .code:n = { \tl_gset:Nn \l__circledtext_character_format_tl {#1} \__circledtext_calc_char_box_size: }, + % charf .initial:n = \normalsize , % 边框类型 boxtype .code:n = { \exp_args:NNx \clist_if_in:NnTF \g__circledtext_char_box_list_clist {#1} @@ -741,20 +844,26 @@ crosscolorratio .initial:n = 30, % 字符颜色 - charcolor .code:n = { \__circledtext_color_select:nn { circledtextcharcolor } {#1} } , + charcolor .code:n = { \__circledtext_color_select:nn { circledtextcharcolor } {#1} + \tl_if_eq:nnT { #1 } { black } + { + \__circledtext_color_select:nn { circledtextboxfill } + { white } + \cs_set_nopar:Npn \__circledtext_aux_color_boxfill: + { \color_fill:n { white } } + } + } , 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 } + { white } + \cs_set_nopar:Npn \__circledtext_aux_color_boxfill: + { \color_fill:n { white } } }{ \__circledtext_color_select:nn { circledtextboxfill } {#1} \cs_set_nopar:Npn \__circledtext_aux_color_boxfill: { \color_fill:n {#1} } @@ -776,6 +885,10 @@ dashpattern .tl_set:N = \l__circledtext_dash_pattern_tl , dashpattern .initial:n = { } , + % 字符自身缩放比例 + charshrink .fp_set:N = \l__circledtext_char_shrink_fp , + charshrink .initial:n = 0.75, + unknown .code:n = { \msg_error:nn { circledtext } { unknown-option } } } \msg_new:nnn { circledtext } { unknown-option } @@ -812,7 +925,9 @@ % 选项设置用户接口 \NewDocumentCommand \circledtextset { m } - { \keys_set:nn { circledtext } {#1} } + { + \keys_set:nn { circledtext } {#1} + } % 构建字符盒子,如字符为空,则用基字符构造 % #1 需要处理的字符(串) @@ -850,21 +965,24 @@ % 复制盒子准备缩放与输出 \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 } - } + % % 测量盒子容器总高度(用内切圆则不需要) + % \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 } + % 下沉距离=字符深度+外框线宽 + \dim_add:Nn \l__circledtext_char_dp_dim { \l__circledtext_box_linewidth_dim } + % 输出盒子(下沉深度距离) \coffin_typeset:Nnnnn \l__circledtext_box_coffin { l } { b } { 0pt } { -\l__circledtext_char_dp_dim } @@ -888,17 +1006,12 @@ % 按指定的格式和内容构造一个字符盒子容器 \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 } - } - % } + \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 } } @@ -929,12 +1042,10 @@ \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 } - } + % 按指定缩放系数对字符盒子容器进行缩放 + \coffin_scale:Nnn \l__circledtext_box_coffin + { \l__circledtext_char_shrink_fp } + { \l__circledtext_char_shrink_fp } % 绘制外框并拼装结果 \draw_begin: diff --git a/macros/latex/contrib/circledtext/circledtext.tex b/macros/latex/contrib/circledtext/circledtext.tex index ec6201932e..2df0d98782 100644 --- a/macros/latex/contrib/circledtext/circledtext.tex +++ b/macros/latex/contrib/circledtext/circledtext.tex @@ -119,7 +119,7 @@ { \__codedoc_cmd:no {#1} { #2 } } \ExplSyntaxOff -\def\vers{\texttt{v1.0.0} } +\def\vers{\texttt{v1.1.0} } \begin{document} \title{ @@ -149,7 +149,7 @@ \pkg{circledtext}是一个基于\pkg{l3draw}用\pkg{expl3}开发的 排版带圈文字的宏包,它提供了唯一的一个排版命令\tn{circledtext}% -用于对其必选参数中的字符(串)按指定的基字符大小缩放后,再为其添加 +用于对其必选参数中的文本按指定的基字符大小缩放后,再为其添加 圆形边框,然后排版输出。其带星号``*''命令\tn{circledtext*}用于 实现反色阴文排版输出。可以通过该命令的命令选项或\tn{circledtextset}% 命令设置排版输出的不同外观。 @@ -160,13 +160,13 @@ \begin{function}{\circledtext} \begin{syntax} - \cs{circledtext} \oarg{外观选项} \marg{字符(串)} + \cs{circledtext} \oarg{外观选项} \marg{文本} \end{syntax} \end{function} - 按设置的\oarg{外观选项}对指定的\marg{字符(串)}添加圆圈后排版输出。 + 按设置的\oarg{外观选项}对指定的\marg{文本}添加圆圈后排版输出。 - 该命令仅有一个必选参数\marg{字符(串)},用于指定需要排版的文本。 + 该命令仅有一个必选参数\marg{文本},用于指定需要排版的文本。 在\oarg{外观选项}中可以通过key-value的方式设置颜色、字体、字号、线宽等外观。 @@ -193,7 +193,7 @@ \end{syntax} \end{function} - 用于设置一个外围圆圈及字符(串)的外观。 + 用于设置外围圆圈及文本的外观。 在\marg{外观选项}中可以通过key-value方式设置颜色、 字体、字号、线宽等外观。 @@ -204,42 +204,46 @@ \begin{option}{ opt = basechar, desc = {= \meta{基字符}}, init=好/x } 设置尺寸测度基字符,如果使用|xetex|或|luatex|引擎编译 - 则初始值为中文“好”字,否则使用英文``x''。 + 则初始值为中文“好”字,否则使用英文字母``x''。 \end{option}\\ \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] \centering \circledtext{五}\quad \circledtext{一佰}\quad - \circledtext[basechar=m]{999} + \circledtext[basechar=M]{999} \end{SideBySideExample} \bigskip \begin{option}{ opt = charf, desc = {= \meta{格式命令}}, init=\tn{normalsize} } - 设置字符(串)格式,初始值为\tn{normalsize}。 + 设置文本格式,初始值为\tn{normalsize}。 \end{option}\\ \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] \centering \circledtext{五}\qquad - \circledtext[charf=\Huge\sffamily]{九} + \circledtext[charf=\Huge]{九} \end{SideBySideExample} +% 字体设置会影响后续内容,原因还未查明 \bigskip \begin{option}{ opt = boxtype, desc = {= \meta{外框类型}}, init=o } 设置外框类型,目前支持: \end{option}\\ \begin{Description} - \item |o|---实心填充圆(小写英文字母``o'')。 + \item |o|---实心填充圆(小写英文字母``|o|'')。 \item |o+|---十字填充圆。 - \item |ox|---对角十字填充圆(小写英文字母``x'')。 + \item |ox|---对角十字填充圆(小写英文字母``|x|'')。 \item |ox+|---米字填充圆。 - \item |x+|---米字填充背景。 - \item |O|---实心填充正方形(大写英文字母``O'')。 + \item |x+|---米字背景(边框为圆但不显示)。 + \item |O|---实心填充正方形(大写英文字母``|O|'')。 \item |O+|---十字填充正方形。 - \item |OX|---对角十字填充正方形(小写英文字母``X'')。 + \item |OX|---对角十字填充正方形(小写英文字母``|X|'')。 \item |OX+|---米字填充正方形。 - \item |X+|---米字填充背景。 + \item |X+|---米字背景(边框为正方形但不显示)。 + \item |oo|---同心圆背景。 + \item |Oo|---前景色填充正方叠加背景色圆背景。 + \item |OO|---同心正方形背景。 \end{Description} \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] \centering @@ -259,6 +263,30 @@ \circledtext[boxtype=X+ ]{戊} \end{SideBySideExample} +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] + \centering + \circledtextset{boxcolor=red} + \circledtext[boxtype=oo ]{车}\quad + \circledtext[boxtype=Oo ]{马}\quad + \circledtext[boxtype=OO ]{炮}\quad + \circledtext*[boxtype=oo ]{车}\quad + \circledtext*[boxtype=Oo ]{马}\quad + \circledtext*[boxtype=OO ]{炮} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = charshrink, desc = {= \meta{文本缩放系数}}, init=0.75 } + 设置文本缩放系数。 +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtext[charshrink=0.75]{甲}\quad + \circledtext[charshrink=1.00]{乙}\quad + \circledtext[charshrink=0.50]{丙}\quad + \circledtext[charshrink=0.35]{丁} +\end{SideBySideExample} + \bigskip \begin{option}{ opt = resize, desc = {= \meta{缩放方式}}, init=none } @@ -381,8 +409,8 @@ \bigskip -\begin{option}{ opt = charcolor, desc = {= \meta{字符(串)颜色}}, init=black } - 设置字符(串)颜色。 +\begin{option}{ opt = charcolor, desc = {= \meta{文本颜色}}, init=black } + 设置文本颜色。 \end{option}\\ \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] \centering @@ -408,7 +436,7 @@ \bigskip \begin{option}{ opt = charstroke, desc = {= \meta{笔画类型}}, init=无 } - 设置字符(串)笔画类型。 + 设置文本笔画类型。 \end{option}\\ \begin{Description} \item |none|---原始笔画轮廓。 @@ -515,7 +543,7 @@ text. \centering \circledtext{8}\quad \circledtext{100}\quad - \circledtext[basechar=m]{three} + \circledtext[basechar=M]{three} \end{SideBySideExample} \bigskip @@ -526,7 +554,7 @@ text. \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] \centering \circledtext{8}\qquad - \circledtext[charf=\Huge\sffamily]{9} + \circledtext[charf=\Huge]{9} \end{SideBySideExample} \bigskip @@ -539,12 +567,15 @@ text. \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. + \item |x+|---diagonal cross and cross(hided circle bg). + \item |O|---filled square(capital "O"). + \item |O+|---filled square with cross. + \item |OX|---filled square with diagonal cross(capital "X"). + \item |OX+|---filled square with diagonal cross and cross. + \item |X+|---diagonal cross and cross(hided square bg). + \item |oo|---2 concentric circles. + \item |Oo|---filled square with fg color and filled circle with bg color. + \item |OO|---2 concentric squares. \end{Description} \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] \centering @@ -564,6 +595,30 @@ text. \circledtext[boxtype=X+ ]{14} \end{SideBySideExample} +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2] + \centering + \circledtextset{boxcolor=red} + \circledtext[boxtype=oo ]{88}\quad + \circledtext[boxtype=Oo ]{88}\quad + \circledtext[boxtype=OO ]{88}\quad + \circledtext*[boxtype=oo ]{88}\quad + \circledtext*[boxtype=Oo ]{88}\quad + \circledtext*[boxtype=OO ]{88} +\end{SideBySideExample} + +\bigskip + +\begin{option}{ opt = charshrink, desc = {= \meta{text shrink}}, init=0.75 } + Set text shrink ratio. +\end{option}\\ +\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2] + \centering + \circledtext[charshrink=0.75]{8}\quad + \circledtext[charshrink=1.00]{8}\quad + \circledtext[charshrink=0.50]{8}\quad + \circledtext[charshrink=0.35]{8} +\end{SideBySideExample} + \bigskip \begin{option}{ opt = resize, desc = {= \meta{resize type}}, init=none } diff --git a/macros/latex/contrib/hvextern/Changes b/macros/latex/contrib/hvextern/Changes index 3747ba251a..5543cdd49f 100644 --- a/macros/latex/contrib/hvextern/Changes +++ b/macros/latex/contrib/hvextern/Changes @@ -1,4 +1,7 @@ hvextern.sty ---------------- +v 0.20 2022-04-27 - use L3 for the comma separated lists + cleanup and runsequence + - move the config files into the main file v 0.19 2022-04-23 first CTAN version diff --git a/macros/latex/contrib/hvextern/README b/macros/latex/contrib/hvextern/README index c011f35cd2..1c6052c9fd 100644 --- a/macros/latex/contrib/hvextern/README +++ b/macros/latex/contrib/hvextern/README @@ -1,6 +1,6 @@ -This package allows to write code in tex, latex, Perl, Lua, PYthon, +This package allows to write code in tex, latex, Perl, Lua, Python, and MetaPost into external files, run that code and insert the -output as pdf or png image or text. Parts of the external code +output as pdf/png image or text. Parts of the external code can be listed in the document. The main LaTeX document must be run with the option --shell-escape diff --git a/macros/latex/contrib/hvextern/doc/hvextern.pdf b/macros/latex/contrib/hvextern/doc/hvextern.pdf Binary files differindex 99a251a6e8..bdefe9bd89 100644 --- a/macros/latex/contrib/hvextern/doc/hvextern.pdf +++ b/macros/latex/contrib/hvextern/doc/hvextern.pdf diff --git a/macros/latex/contrib/hvextern/doc/hvextern.tex b/macros/latex/contrib/hvextern/doc/hvextern.tex index 8acd4e841c..50d93cef06 100644 --- a/macros/latex/contrib/hvextern/doc/hvextern.tex +++ b/macros/latex/contrib/hvextern/doc/hvextern.tex @@ -11,6 +11,7 @@ \usepackage{listings} \lstset{basicstyle=\ttfamily\small,language=[LaTeX]TeX,breaklines} \usepackage{xcolor} +\usepackage{hyperref} \begin{document} \title{Writing, running and including the output of external documents from within a main \LaTeX\ document~--v. \hvexternFileversion} @@ -58,6 +59,15 @@ The purpose for this package is to show the output of documents which have to be a different preamble or a different engine or a complete different system, but integrating the output automatically in the main document.. +\bigskip +\noindent +\fbox{\begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax} +\emph{All} examples in this document are created on-the-fly while running this \LaTeX\ document +with \texttt{lualatex} with the \texttt{-\kern2pt-shell-escape} option. +\end{minipage}} + + + \section{First examples} \subsection{Without showing the code} @@ -137,7 +147,7 @@ The png image is created on the fly with the following arguments of \verb|exter The code which is declared as header and main can be marked by: \begin{Verbatim} -\extern@ExampleType{py} +\hv@extern@exampleType{py} {\NumChar StartVisibleMain} {\NumChar StopVisibleMain} {\NumChar StartVisiblePreamble} @@ -296,11 +306,11 @@ The marker for the code ranges which should be listed depend to the used program everything between \verb|%StartVisiblePreamble| and \verb|%StopVisiblePreamble| will be listed as preamble and in case of a \LaTeX\ source everything between - \verb|\begin{document}| and \verb|\end{document}| as body. The marker must be defined in an own - config file, e.g. \texttt{hv-extern-py.cfg}: + \verb|\begin{document}| and \verb|\end{document}| as body. The marker must be defined with an own +macro, e.g.: \begin{verbatim} -\extern@ExampleType{py} +\hv@extern@exampleType{py} {\NumChar StartVisibleMain} {\NumChar StopVisibleMain} {\NumChar StartVisiblePreamble} @@ -314,7 +324,7 @@ is pdflatex. The option \texttt{docType} selects the config file, which must be context, lua, pl, tex, latex, mp, and py. For Lua it is \begin{verbatim} -\extern@ExampleType{lua} +\hv@extern@exampleType{lua} {--StartVisibleMain} {--StopVisibleMain} {--StartVisiblePreamble} @@ -336,7 +346,7 @@ The deafault setting is always shown in brackets. The \texttt{progpath} should only in some rare cases needed. In general all used compilers will be found by the system. A given \texttt{progpath} -must be end with a slash, e.g. \texttt{./bin/} The option \texttt{runsequence} is currently not used. +must be end with a slash, e.g. \texttt{./bin/} %The option \texttt{runsequence} is currently not used. \begin{verbatim} \define@key{hv}{progpath}[]{\def\hv@extern@progpath{#1}} @@ -345,6 +355,54 @@ must be end with a slash, e.g. \texttt{./bin/} The option \texttt{runsequence} i \define@key{hv}{runs}[1]{\setcounter{hv@extern@runs}{#1}} \end{verbatim} +Instead of the optional arguments + \texttt{compiler}, \texttt{biber}, and \texttt{xindex} one can define an individual + command sequence by using the optional argument + \texttt{runsequence}. It must be comma separated list: + +\begin{verbatim} +runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex} +\end{verbatim} + +\begin{externalDocument}[ + grfOptions={width=0.30\linewidth}, + pages={1,3,5}, + frame, + runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex}, + showFilename, + verbose, + force, + cleanup={log,aux,toc,bbl,blg}, + code,docType=latex, + lstOptions={columns=fixed}]{voss} +\documentclass[paper=a5,parskip=half-,DIV=12,fontsize=12pt]{scrbook} +%StartVisiblePreamble +\usepackage[ngerman]{babel} +\usepackage{libertinus,hvindex} +\usepackage{makeidx}\makeindex +\usepackage{biblatex}\addbibresource{biblatex-examples.bib} +%StopVisiblePreamble +\usepackage{blindtext} +\begin{document} +Sort with xindex \verb|-l DE --config AU| +\blindtext +\Index{Österreich} \Index{Öresund} +\Index{Ostern} \Index{Ober} \Index{Oberin} +\Index{Österreich} \Index{Öresund} +\Index{Ödem} \Index{Oligarch} \Index{Oder} +\Index{Goldmann} +\printindex +\nocite{*}\printbibliography +\blindtext +\blinddocument + +\end{document} +\end{externalDocument} + + + + + \subsection{Grafik options} \begin{verbatim} \define@key{hv}{grfOptions}[]{\def\hv@extern@grfOptions{#1}} @@ -469,12 +527,12 @@ The color of the frame is set to the same values, hence not seen. The following \subsection{Type of the source code} The current version of \texttt{hvextern} supports code written as -\MP, \plainTeX, \LaTeX, \ConTeXt, and Python. Every type has its own config file which -defines the keywords for the linerange which should be printed for the preamble and -the body. For example the \texttt{latex} config file \texttt{hvextern-latex,cfg}: +\MP, \plainTeX, \LaTeX, \ConTeXt, and Python. Every type has its own keywords for the +linerange which should be printed for the preamble and +the body. For example the \texttt{latex} config is: \begin{verbatim} -\extern@ExampleType{latex}% for _all_LaTeX engines +\hv@extern@exampleType{latex}% for _all_LaTeX engines {\string\begin\string{document\string}}% {\string\end\string{document\string}}% {\perCent StartVisiblePreamble}% @@ -1000,6 +1058,7 @@ For a \LaTeX\ additional programs for bibliography, index, a.s.o. maybe needed. \define@boolkey{hv}[hv@extern@]{biber}[true]{} \define@boolkey{hv}[hv@extern@]{xindex}[true]{} \define@key{hv}{xindexOptions}[]{\def\hv@extern@xindexOptions{#1}} +\define@key{hv}{runsequence}[]{\def\hv@extern@runsequence{#1}} \end{verbatim} The \texttt{biber} run needs no additional options, but for \texttt{xindex} it maybe useful. @@ -1007,13 +1066,9 @@ The following examples uses \begin{verbatim} \begin{externalDocument}[ - compiler=lualatex, runs=2, - pages=2, - crop, - xindex, - xindexOptions={-l DE --config AU}, - mpwidth=0.6\linewidth, - usefancyvrb=false, + compiler=lualatex, runs=2, pages=2,crop, + xindex, xindexOptions={-l DE --config AU}, + mpwidth=0.6\linewidth, usefancyvrb=false, docType=latex, ... ]{voss} @@ -1073,6 +1128,48 @@ Sort with xindex \verb|-l DE --config AU| \end{externalDocument} +Instad of using the options \texttt{compiler}, \texttt{biber}, and \texttt{xindex} +one can also use only the optional argument \texttt{runsequence} to define an individuell +sequence of commands, e.g.: +\begin{verbatim} +runsequence={lualatex,biber,{xindex -l de -c AU},lualatex,lualatex} +\end{verbatim} + +\begin{externalDocument}[ + grfOptions={width=0.30\linewidth}, + pages={1,3,5}, + frame, + runsequence={lualatex,biber,xindex -l de -c AU,lualatex,lualatex}, + showFilename, + verbose, + force, + cleanup={log,aux,toc,bbl,blg}, + code,docType=latex, + lstOptions={columns=fixed}]{voss} +\documentclass[paper=a5,parskip=half-,DIV=12,fontsize=12pt]{scrbook} +%StartVisiblePreamble +\usepackage[ngerman]{babel} +\usepackage{libertinus,hvindex} +\usepackage{makeidx}\makeindex +\usepackage{biblatex}\addbibresource{biblatex-examples.bib} +%StopVisiblePreamble +\usepackage{blindtext} +\begin{document} +Sort with xindex \verb|-l DE --config AU| +\blindtext +\Index{Österreich} \Index{Öresund} +\Index{Ostern} \Index{Ober} \Index{Oberin} +\Index{Österreich} \Index{Öresund} +\Index{Ödem} \Index{Oligarch} \Index{Oder} +\Index{Goldmann} +\printindex +\nocite{*}\printbibliography +\blindtext +\blinddocument + +\end{document} +\end{externalDocument} + @@ -1301,12 +1398,13 @@ This is the start of the introduction. verbose=false, compiler=lualatex, showFilename, -% crop, + crop, force, code, docType=latex, ext=tex,]{voss} \documentclass{report} +\pagestyle{empty} %StartVisiblePreamble \usepackage{fontenc}\usepackage{libertinus} \usepackage{pst-all} diff --git a/macros/latex/contrib/hvextern/latex/hvextern-context.cfg b/macros/latex/contrib/hvextern/latex/hvextern-context.cfg deleted file mode 100644 index f45cc86153..0000000000 --- a/macros/latex/contrib/hvextern/latex/hvextern-context.cfg +++ /dev/null @@ -1,22 +0,0 @@ -%% This is file `hvextern-ctx.cfg', -%% -%% Copyright (C) 2016-22 Herbert Voß hvoss@tug.org -%% -%% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3c -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. - -\def\hvFileversion{0.01} -\ProvidesFile{hvextern-ctx}[2022/04/21 v\hvFileversion: running context (HV)] - -\extern@ExampleType{context} - {\string\starttext} - {\string\stoptext} - {\perCent StartVisiblePreamble} - {\perCent StopVisiblePreamble} - -\endinput diff --git a/macros/latex/contrib/hvextern/latex/hvextern-latex.cfg b/macros/latex/contrib/hvextern/latex/hvextern-latex.cfg deleted file mode 100644 index 8f186f9e58..0000000000 --- a/macros/latex/contrib/hvextern/latex/hvextern-latex.cfg +++ /dev/null @@ -1,31 +0,0 @@ -%% This is file `hvextern-mp.cfg', -%% -%% Copyright (C) 2016-22 Herbert Voß hvoss@tug.org -%% -%% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3c -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. - -\def\hvFileversion{0.01} -\ProvidesFile{hvextern-latex}[2022/04/21 v\hvFileversion: running latex (HV)] - -\extern@ExampleType{latex}% - {\string\begin\string{document\string}}% - {\string\end\string{document\string}}% - {\perCent StartVisiblePreamble}% - {\perCent StopVisiblePreamble}% - -% only for the sequence latex->dvips->ps2pdf -\def\hv@extern@runLATEX#1#2#3#4{% path compiler file extension - \ifhv@extern@verbose \typeout{>>>> running #1#2 #3#4}\fi - \ShellEscape{#1#2\space #3#4}% - \ifhv@extern@verbose \typeout{>>>> running #1dvips #3}\fi - \ShellEscape{#1dvips\space #3.dvi}% - \ifhv@extern@verbose \typeout{>>>> running ps2pdf #3.ps}\fi - \ShellEscape{#1ps2pdf\space -dAutoRotatePages=/None\space -dALLOWPSTRANSPARENCY\space #3.ps}% -} -\endinput diff --git a/macros/latex/contrib/hvextern/latex/hvextern-lua.cfg b/macros/latex/contrib/hvextern/latex/hvextern-lua.cfg deleted file mode 100644 index 85a3ee6920..0000000000 --- a/macros/latex/contrib/hvextern/latex/hvextern-lua.cfg +++ /dev/null @@ -1,22 +0,0 @@ -%% This is file `hvextern-lua.cfg', -%% -%% Copyright (C) 2016-22 Herbert Voß hvoss@tug.org -%% -%% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3c -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. - -\def\hvFileversion{0.01} -\ProvidesFile{hvextern-lua}[2022/04/23 v\hvFileversion: running Lua (HV)] - -\extern@ExampleType{lua} - {--StartVisibleMain} - {--StopVisibleMain} - {--StartVisiblePreamble} - {--StopVisiblePreamble} - -\endinput diff --git a/macros/latex/contrib/hvextern/latex/hvextern-mp.cfg b/macros/latex/contrib/hvextern/latex/hvextern-mp.cfg deleted file mode 100644 index 9e42167f9c..0000000000 --- a/macros/latex/contrib/hvextern/latex/hvextern-mp.cfg +++ /dev/null @@ -1,32 +0,0 @@ -%% This is file `hvextern-mp.cfg', -%% -%% Copyright (C) 2016-22 Herbert Voß hvoss@tug.org -%% -%% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3c -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. - -\def\hvFileversion{0.01} -\ProvidesFile{hvextern-mp}[2022/04/21 v\hvFileversion: running MetaPost (HV)] - -\extern@ExampleType{mp} - {beginfig(1)} - {endfig;} - {\perCent StartVisiblePreamble} - {\perCent StopVisiblePreamble} - -\def\hv@extern@runMP#1#2#3#4{% path compiler file extension - \ifhv@extern@verbose \typeout{>>>> running #1#2 #3#4}\fi - \ShellEscape{#1#2\space -tex=tex\space #3#4}% - \ifhv@extern@verbose \typeout{>>>> running #1tex #3}\fi - \ShellEscape{#1tex\space "\string\input\space epsf\string\relax\string\nopagenumbers\string\epsfbox{#3.1}\string\bye"}% - \ifhv@extern@verbose \typeout{>>>> running #1dvips #3}\fi - \ShellEscape{#1dvips\space -j\space -E\space -o\space #3.eps\space epsf.dvi}% - \ifhv@extern@verbose \typeout{>>>> running #1epstopdf #3}\fi - \ShellEscape{#1epstopdf\space #3.eps}% -} -\endinput diff --git a/macros/latex/contrib/hvextern/latex/hvextern-pl.cfg b/macros/latex/contrib/hvextern/latex/hvextern-pl.cfg deleted file mode 100644 index 656f2d8177..0000000000 --- a/macros/latex/contrib/hvextern/latex/hvextern-pl.cfg +++ /dev/null @@ -1,22 +0,0 @@ -%% This is file `hvextern-pl.cfg', -%% -%% Copyright (C) 2016-22 Herbert Voß hvoss@tug.org -%% -%% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3c -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. - -\def\hvFileversion{0.01} -\ProvidesFile{hvextern-pl}[2022/04/22 v\hvFileversion: running Perl (HV)] - -\extern@ExampleType{pl} - {\NumChar StartVisibleMain} - {\NumChar StopVisibleMain} - {\NumChar StartVisiblePreamble} - {\NumChar StopVisiblePreamble} - -\endinput diff --git a/macros/latex/contrib/hvextern/latex/hvextern-py.cfg b/macros/latex/contrib/hvextern/latex/hvextern-py.cfg deleted file mode 100644 index eaf51f8212..0000000000 --- a/macros/latex/contrib/hvextern/latex/hvextern-py.cfg +++ /dev/null @@ -1,27 +0,0 @@ -%% This is file `hvextern-py.cfg', -%% -%% Copyright (C) 2016-22 Herbert Voß hvoss@tug.org -%% -%% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3c -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. - -\def\hvFileversion{0.01} -\ProvidesFile{hvextern-py}[2022/04/22 v\hvFileversion: running Python (HV)] - -\extern@ExampleType{py} - {\NumChar StartVisibleMain} - {\NumChar StopVisibleMain} - {\NumChar StartVisiblePreamble} - {\NumChar StopVisiblePreamble} - -%\def\hv@extern@runPYTHON#1#2#3#4{% path compiler file extension -% \ifhv@extern@verbose \typeout{>>>> running #1#2 #3#4}\fi -% \ShellEscape{#1python2\space #3#4}% for special version -%} - -\endinput diff --git a/macros/latex/contrib/hvextern/latex/hvextern-tex.cfg b/macros/latex/contrib/hvextern/latex/hvextern-tex.cfg deleted file mode 100644 index 2baf3552f8..0000000000 --- a/macros/latex/contrib/hvextern/latex/hvextern-tex.cfg +++ /dev/null @@ -1,30 +0,0 @@ -%% This is file `hvextern-mp.cfg', -%% -%% Copyright (C) 2016-22 Herbert Voß hvoss@tug.org -%% -%% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3c -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. - -\def\hvFileversion{0.01} -\ProvidesFile{hvextern-latex}[2022/04/21 v\hvFileversion: running latex (HV)] - -\extern@ExampleType{tex} - {\perCent StartBody} - {\string\bye} - {\perCent StartVisiblePreamble} - {\perCent StopVisiblePreamble} - -\def\hv@extern@runTEX#1#2#3#4{% path compiler file extension - \ifhv@extern@verbose \typeout{>>>> running #1#2 #3#4}\fi - \ShellEscape{#1tex\space #3#4}% - \ifhv@extern@verbose \typeout{>>>> running #1dvips #3}\fi - \ShellEscape{#1dvips\space #3.dvi}% - \ifhv@extern@verbose \typeout{>>>> running ps2pdf #3.ps}\fi - \ShellEscape{#1ps2pdf\space -dAutoRotatePages=/None\space -dALLOWPSTRANSPARENCY\space #3.ps}% -} -\endinput diff --git a/macros/latex/contrib/hvextern/latex/hvextern.sty b/macros/latex/contrib/hvextern/latex/hvextern.sty index 201f4ef7b1..9e3fbea8c0 100644 --- a/macros/latex/contrib/hvextern/latex/hvextern.sty +++ b/macros/latex/contrib/hvextern/latex/hvextern.sty @@ -11,11 +11,11 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2005/12/01 or later. -\def\hvexternFileversion{0.19} -\ProvidesFile{hvextern}[2022/04/23 v\hvexternFileversion: package for running external documents (HV)] +\def\hvexternFileversion{0.20} +\ProvidesFile{hvextern}[2022/04/27 v\hvexternFileversion: package for running external documents (HV)] \RequirePackage{shellesc,xkeyval,graphicx,marginnote,fancyvrb,tikz,listings,ifplatform} -\RequirePackage{tcolorbox} +\RequirePackage{tcolorbox,xparse} \tcbuselibrary{skins,breakable} \ifwindows @@ -29,8 +29,8 @@ \newcounter{hv@extern@runs} \newcounter{@@@runs} \newsavebox\hv@extern@box -\newlength\LineWidth -\AtBeginDocument{\setlength\LineWidth{\dimexpr\linewidth-2\fboxsep-2\fboxrule}} +\newlength\hv@LineWidth +\AtBeginDocument{\setlength\hv@LineWidth{\dimexpr\linewidth-2\fboxsep-2\fboxrule}} \newlength\hv@extern@mpwidth \setlength\hv@extern@mpwidth{\z@} \define@key{hv}{progpath}{\def\hv@extern@progpath{#1}} @@ -49,6 +49,7 @@ \define@key{hv}{cropmargin}[2]{\def\hv@extern@cropmargin{#1 }} \define@key{hv}{mpwidth}[0pt]{\setlength\hv@extern@mpwidth{#1}} \define@key{hv}{ext}[tex]{\def\hv@extern@ext{.#1}} +\define@boolkey{hv}[hv@extern@]{redirect}[true]{} \define@boolkey{hv}[hv@extern@]{usefancyvrb}[true]{} \define@boolkey{hv}[hv@extern@]{showFilename}[true]{} \define@boolkey{hv}[hv@extern@]{code}[true]{} @@ -93,6 +94,7 @@ code=false,% show Code crop=false,% erzeugte PDF "croppen" compiler=pdflatex,% zu verwendener Compiler + redirect=false,% write output into a file *.txt grfOptions={},% Optionen der einzubindenden Grafik lstOptions={},% Optionen für das Listing BGpreamble=black!12,% Backgroundcolor for preamble @@ -134,20 +136,19 @@ \gdef\DoubleNumChar{##} } -\def\run@hv@extern@cleanup#1{\expandafter\run@hv@extern@cleanup@i#1,\@nil} -\def\run@hv@extern@cleanup@i#1,#2\@nil{% - \def\hv@next{}% - \ifx\relax#1\relax - \else - \hv@typeout{>>>> Delete file \hv@extern@ExamplesDir\hvExternDateiname.#1}% - \ShellEscape{\hv@rm \hv@extern@ExamplesDir\hvExternDateiname.#1}% - \ifx\relax#2\relax\else - \def\hv@next{\run@hv@extern@cleanup@i#2,\@nil}% - \fi - \fi - \hv@next -} - +\ExplSyntaxOn +\NewDocumentCommand\run@hv@extern@cleanup{ m } + { + \clist_map_inline:nn {#1}{\ShellEscape{\hv@rm \hv@extern@ExamplesDir\hvExternDateiname.##1}} + } +\NewDocumentCommand\run@hv@extern@sequenceList{ m } + { + \clist_map_inline:nn {#1}{% + \ShellEscape{\hv@extern@progpath##1\space\hvExternDateiname} + %\hv@typeout{>>>> sequencerun: ##1} + } + } +\ExplSyntaxOff \lstset{belowskip=0pt,aboveskip=0pt}% global \tcbset{breakable,left=2pt,right=2pt,top=2pt,bottom=2pt,boxsep=0pt} @@ -162,25 +163,109 @@ \newcounter{hv@example@counter} -\newcommand\extern@ExampleType[5]{% +\newcommand\hv@extern@ExampleType[5]{% \@namedef{#1@initTextFancy}{\edef\FancyVerbStartString{#2}\edef\FancyVerbStopString{#3}}% text \@namedef{#1@initPreambleFancy}{\edef\FancyVerbStartString{#4}\edef\FancyVerbStopString{#5}}% code \@namedef{#1@initText}{linerange={#2}-{#3},includerangemarker=false}% text \@namedef{#1@initPreamble}{linerange={#4}-{#5},includerangemarker=false}% code }% ^^to prevent problems with lua comments -\input{hvextern-mp.cfg} -\input{hvextern-tex.cfg} -\input{hvextern-latex.cfg} -\input{hvextern-context.cfg} -\input{hvextern-py.cfg} -\input{hvextern-pl.cfg} -\input{hvextern-lua.cfg} +%%------------------ the config part -------------------- +%\input{hvextern-mp.cfg} +%---- MP +\hv@extern@ExampleType{mp} + {beginfig(1)} + {endfig;} + {\perCent StartVisiblePreamble} + {\perCent StopVisiblePreamble} + +\def\hv@extern@runMP#1#2#3#4{% path compiler file extension + \hv@typeout{>>>> running #1#2 #3#4}% + \ShellEscape{#1#2\space -tex=tex\space #3#4}% + \hv@typeout{>>>> running #1tex #3}% + \ShellEscape{#1tex\space "\string\input\space epsf\string\relax\string\nopagenumbers\string\epsfbox{#3.1}\string\bye"}% + \hv@typeout{>>>> running #1dvips #3}% + \ShellEscape{#1dvips\space -j\space -E\space -o\space #3.eps\space epsf.dvi}% + \hv@typeout{>>>> running #1epstopdf #3}% + \ShellEscape{#1epstopdf\space #3.eps}% +} + +%---- TeX +%\input{hvextern-tex.cfg} +\hv@extern@ExampleType{tex} + {\perCent StartBody} + {\string\bye} + {\perCent StartVisiblePreamble} + {\perCent StopVisiblePreamble} + +\def\hv@extern@runTEX#1#2#3#4{% path compiler file extension + \hv@typeout{>>>> running #1#2 #3#4}% + \ShellEscape{#1tex\space #3#4}% + \hv@typeout{>>>> running #1dvips #3}% + \ShellEscape{#1dvips\space #3.dvi}% + \hv@typeout{>>>> running ps2pdf #3.ps}% + \ShellEscape{#1ps2pdf\space -dAutoRotatePages=/None\space -dALLOWPSTRANSPARENCY\space #3.ps}% +} + +%---- LaTeX +%\input{hvextern-latex.cfg} +\hv@extern@ExampleType{latex}% + {\string\begin\string{document\string}}% + {\string\end\string{document\string}}% + {\perCent StartVisiblePreamble}% + {\perCent StopVisiblePreamble}% + +% only for the sequence latex->dvips->ps2pdf +\def\hv@extern@runLATEX#1#2#3#4{% path-compiler-file-extension + \hv@typeout{>>>> running #1#2 #3#4}% + \ShellEscape{#1#2\space #3#4}% + \hv@typeout{>>>> running #1dvips #3}% + \ShellEscape{#1dvips\space #3.dvi}% + \hv@typeout{>>>> running ps2pdf #3.ps}% + \ShellEscape{#1ps2pdf\space -dAutoRotatePages=/None\space -dALLOWPSTRANSPARENCY\space #3.ps}% +} + +%---- ConTeXt +%\input{hvextern-context.cfg} +\hv@extern@ExampleType{context} + {\string\starttext} + {\string\stoptext} + {\perCent StartVisiblePreamble} + {\perCent StopVisiblePreamble} + +%---- Python +%\input{hvextern-py.cfg} +\hv@extern@ExampleType{py} + {\NumChar StartVisibleMain} + {\NumChar StopVisibleMain} + {\NumChar StartVisiblePreamble} + {\NumChar StopVisiblePreamble} + + +%---- Perl +%\input{hvextern-pl.cfg} +\hv@extern@ExampleType{pl} + {\NumChar StartVisibleMain} + {\NumChar StopVisibleMain} + {\NumChar StartVisiblePreamble} + {\NumChar StopVisiblePreamble} + + +%---- Lua +%\input{hvextern-lua.cfg} +\hv@extern@ExampleType{lua} + {--StartVisibleMain} + {--StopVisibleMain} + {--StartVisiblePreamble} + {--StopVisiblePreamble} + + +%%%--------------------------------- end config part ------------------ %% %% [#1]: Optionen #2: Dateiname %% -\newenvironment{ErstelleGrafik}[2][]{% +\newenvironment{externalDocument}[2][]{% \xdef\hvExternDateiname{#2-\arabic{hv@example@counter}}% \setkeys{hv}{#1}% \begin \expandafter\IfFileExists\expandafter{\hv@extern@ExamplesDir\hvExternDateiname.pdf}{}{% @@ -196,33 +281,41 @@ \global\stepcounter{hv@example@counter}% \endgroup \ifhv@extern@force - \hv@typeout{>>> force=true: running \hv@extern@progpath\hv@extern@compiler~ \hvExternDateiname\hv@extern@ext ...}% - \setcounter{@@@runs}{\value{hv@extern@runs}}% - \loop\ifnum\the@@@runs > 0\relax - \ifcase\hv@extern@compilerNo \relax % we have metapost - \hv@typeout{>>>> running mpost \hvExternDateiname\hv@extern@ext}% - \hv@extern@runMP{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}% - \or %1 - \hv@typeout{>>>> running tex \hvExternDateiname\hv@extern@ext}% - \hv@extern@runTEX{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}% - \or %2 - \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}% - \hv@extern@runLATEX{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}% - \else - \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}% - \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname\hv@extern@ext}% + \ifx\hv@extern@runsequence\@empty + \hv@typeout{>>>> force=true: running \hv@extern@progpath\hv@extern@compiler~ \hvExternDateiname\hv@extern@ext ...}% + \setcounter{@@@runs}{\value{hv@extern@runs}}% + \loop\ifnum\the@@@runs > 0\relax + \ifcase\hv@extern@compilerNo \relax % we have metapost + \hv@typeout{>>>> running mpost \hvExternDateiname\hv@extern@ext}% + \hv@extern@runMP{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}% + \or %1 + \hv@typeout{>>>> running tex \hvExternDateiname\hv@extern@ext}% + \hv@extern@runTEX{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}% + \or %2 + \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}% + \hv@extern@runLATEX{\hv@extern@progpath}{\hv@extern@compiler}{\hvExternDateiname}{\hv@extern@ext}% + \else + \hv@typeout{>>>> running \hv@extern@compiler~ \hvExternDateiname\hv@extern@ext}% + \ifhv@extern@redirect + \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname\hv@extern@ext\space > \hvExternDateiname.txt}% + \else + \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname\hv@extern@ext}% + \fi + \fi + \addtocounter{@@@runs}{-1}% + \repeat + \hv@typeout{>>> ... done}% + \ifhv@extern@biber + \ShellEscape{biber \hvExternDateiname}% NAch biber nochmal latex + \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname}% \fi - \addtocounter{@@@runs}{-1}% - \repeat - \hv@typeout{>>> ... done}% - \ifhv@extern@biber - \ShellEscape{biber \hvExternDateiname}% NAch biber nochmal latex - \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname}% - \fi - \ifhv@extern@xindex - \ShellEscape{xindex \hv@extern@xindexOptions\space \hvExternDateiname.idx}% NAch xindex nochmal latex - \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname}% - \fi + \ifhv@extern@xindex + \ShellEscape{xindex \hv@extern@xindexOptions\space \hvExternDateiname.idx}% NAch xindex nochmal latex + \ShellEscape{\hv@extern@progpath\hv@extern@compiler\space\hvExternDateiname}% + \fi + \else + \expandafter\run@hv@extern@sequenceList\expandafter{\hv@extern@runsequence}% + \fi \ifhv@extern@crop \ShellEscape{pdfcrop --margins \hv@extern@cropmargin \hvExternDateiname}% \ShellEscape{\hv@move \hvExternDateiname-crop.pdf \hvExternDateiname.pdf}% @@ -302,7 +395,8 @@ \hspace{5pt}}\hspace*{-5pt}% \else \expandafter\@for\expandafter\next\expandafter:\expandafter=\hv@extern@pages\do{% - \expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]{\hv@extern@ExamplesDir\hvExternDateiname}% + \expandafter\includegraphics\expandafter[\hv@extern@grfOptions,page=\next]% + {\hv@extern@ExamplesDir\hvExternDateiname}% \hspace{5pt}}\hspace*{-5pt}% \fi \ifx\hv@extern@caption\@empty\else\caption{\hv@extern@caption}\fi @@ -322,11 +416,9 @@ \noindent\VerbatimInput{\hv@extern@ExamplesDir\hvExternDateiname.txt} \fi \fi - \ifhv@extern@force\run@hv@extern@cleanup{\hv@extern@cleanup}\fi% cleanup + \ifhv@extern@force\expandafter\run@hv@extern@cleanup\expandafter{\hv@extern@cleanup}\fi% cleanup } \stepcounter{hv@example@counter}% % -\let\externalDocument\ErstelleGrafik -\let\endexternalDocument\endErstelleGrafik %% \endinput diff --git a/macros/latex/contrib/postnotes/CHANGELOG.md b/macros/latex/contrib/postnotes/CHANGELOG.md index dad884203a..27ebf1ab31 100644 --- a/macros/latex/contrib/postnotes/CHANGELOG.md +++ b/macros/latex/contrib/postnotes/CHANGELOG.md @@ -1,6 +1,14 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/postnotes/compare/v0.1.1...HEAD) +## [Unreleased](https://github.com/gusbrs/postnotes/compare/v0.1.2...HEAD) + +## [v0.1.2](https://github.com/gusbrs/postnotes/compare/v0.1.1...v0.1.2) (2022-04-27) + +### Added +- `\postnotesectionx`, a version of `\postnotesection` which expands the + content in place. +- French localization (see issue + [#1](https://github.com/gusbrs/postnotes/issues/1)). ## [v0.1.1](https://github.com/gusbrs/postnotes/compare/v0.1.0...v0.1.1) (2022-04-21) diff --git a/macros/latex/contrib/postnotes/postnotes-code.pdf b/macros/latex/contrib/postnotes/postnotes-code.pdf Binary files differindex ac1c84d450..8271b11509 100644 --- a/macros/latex/contrib/postnotes/postnotes-code.pdf +++ b/macros/latex/contrib/postnotes/postnotes-code.pdf diff --git a/macros/latex/contrib/postnotes/postnotes.dtx b/macros/latex/contrib/postnotes/postnotes.dtx index d817519754..703466554b 100644 --- a/macros/latex/contrib/postnotes/postnotes.dtx +++ b/macros/latex/contrib/postnotes/postnotes.dtx @@ -147,7 +147,7 @@ % % % \begin{macrocode} -\ProvidesExplPackage {postnotes} {2022-04-21} {0.1.1} +\ProvidesExplPackage {postnotes} {2022-04-27} {0.1.2} {Endnotes for LaTeX} % \end{macrocode} % @@ -1064,14 +1064,21 @@ % % \section{\cs{postnotesection}} % -% \begin{macro}[int]{\postnotesection} -% Provide \cs{postnotesection}. +% \begin{macro}[int] +% { +% \postnotesection , +% \postnotesectionx , +% } +% Provide \cs{postnotesection} and \cs{postnotesectionx}. % \begin{syntax} % \cs{postnotesection}\oarg{options}\marg{section content} +% \cs{postnotesectionx}\oarg{options}\marg{section content} % \end{syntax} % \begin{macrocode} \NewDocumentCommand \postnotesection { O { } +m } { \@@_section:nn {#1} {#2} } +\NewDocumentCommand \postnotesectionx { O { } +m } + { \@@_section:nx {#1} {#2} } % \end{macrocode} % \end{macro} % @@ -1093,6 +1100,7 @@ \@@_store_section:nn { \l_@@_note_id_tl } {#2} \group_end: } +\cs_generate_variant:Nn \@@_section:nn { nx } % \end{macrocode} % \end{macro} % @@ -1458,9 +1466,9 @@ % must have been stored with the \cs{l_@@_maybe_multi_bool} set to % \texttt{true}, which is then saved in the \texttt{multibool} property. One % implication of this procedure is that, if there are any new notes marked as -% \texttt{multibool}, (at least) three rounds of compilation will be needed, -% since the labels of the printed notes will be written only on the second run -% and the document will thus require a third one to stabilize. +% \texttt{multibool}, three rounds of compilation will be needed, since the +% labels of the printed notes will be written only on the second run and the +% document will thus require a third one to stabilize. % % \begin{macro}{\@@_verify_multipass:N} % \begin{syntax} @@ -1940,10 +1948,10 @@ % From the user's perspective, one-line captions will just work. For two-line % captions, there are two alternatives: i) decrement the counter by 1 % \texttt{\textbackslash{}addtocounter\{postnote\}\{-1\}} before the caption, -% then call \cs{postnote} inside the caption; or ii) call -% \texttt{\textbackslash{}postnote[nomark]\{\textbackslash{}label\{mynote\}...\}} -% right before the caption, then use -% \texttt{\textbackslash{}postnoteref\{mynote\}} inside the caption. +% then call \cs{postnote} inside the caption; or ii) right before the caption, +% call +% \texttt{\textbackslash{}postnote[nomark]\{\textbackslash{}label\{mynote\}...\}}, +% then use \texttt{\textbackslash{}postnoteref\{mynote\}} inside the caption. % % \begin{macrocode} \AddToHook { postnotes/note/begin } [ postnotes ] @@ -2577,6 +2585,27 @@ % \end{macrocode} % % +% \subsection*{French} +% +% French localization validated by \texttt{Pika78} at \githubissue{1}. +% +% \begin{macrocode} +\@@_define_language:nn { french } + { + \tl_set:Nn \pntitle { Notes } + \tl_set:Nn \pnhdnotes { Notes } + \tl_set:Nn \pnhdtopage { de~la~page } + \tl_set:Nn \pnhdtopages { des~pages } + } +\@@_set_babel_language:nn { french } { french } +\@@_set_babel_language:nn { acadian } { french } +\@@_set_babel_language:nn { canadien } { french } +\@@_set_babel_language:nn { francais } { french } +\@@_set_babel_language:nn { frenchb } { french } +\@@_set_polyglossia_language:nn { french } { french } +% \end{macrocode} +% +% % \begin{macrocode} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/postnotes/postnotes.pdf b/macros/latex/contrib/postnotes/postnotes.pdf Binary files differindex 56441582f2..69960a6f33 100644 --- a/macros/latex/contrib/postnotes/postnotes.pdf +++ b/macros/latex/contrib/postnotes/postnotes.pdf diff --git a/macros/latex/contrib/postnotes/postnotes.tex b/macros/latex/contrib/postnotes/postnotes.tex index eab8f438ed..c47a9d9cdf 100644 --- a/macros/latex/contrib/postnotes/postnotes.tex +++ b/macros/latex/contrib/postnotes/postnotes.tex @@ -278,7 +278,10 @@ for making notes subdivisions, and it places \meta{text} between the notes where it occurs, at the point the notes are printed by \cs{printpostnotes}. For more details and some examples, see \zcref{sec:notes-sections}. Its \meta{options} are presented in \zcref{sec:options}, -\zcref[ref=title,noname]{sec:section-options}. +\zcref[ref=title,noname]{sec:section-options}. A \cs{postnotesectionx} is +also provided which expands \meta{text} in place (\texttt{x}-type expansion) +before storing it (differently from \cs{postnotesection} which stores +\meta{text} with ``no manipulation''). \begin{function}{\printpostnotes} \begin{syntax} @@ -525,33 +528,35 @@ Just like with \cs{postnote}, the contents of \cs{postnotesection} are not expanded in place, but rather stored with ``no manipulation'' to be typeset later at \cs{printpostnotes}. For this reason, some contextual information is stored at the place \cs{postnotesection} is called, and made available at the -point it's content gets expanded by means of some variables. When the content -of a notes section gets typeset, \cs{pnthechapter} contains the value of -\cs{thechapter} where \cs{postnotesection} was originally called. Similarly, -\cs{pnthesection} contains the value of \cs{thesection}. -\cs{pnthechapternextnote} and \cs{pnthesectionnextnote} are meant to support -the automation of the notes subdivision by using hooks to sectioning commands, -which is a quite natural way to do this. However, since it may be problematic -to hook \emph{after} sectioning commands -- \cs{section}, for example, figures -prominently in the documentation of \pkg{ltcmdhooks} as a case of ``look -ahead'' command for which the \texttt{after} hook is not supported -- we will -typically want to hook \emph{before} them. But, at this point the values of -the \texttt{chapter} or \texttt{section} counters have not yet been stepped, -therefore \cs{thechapter} and \cs{thesection} do not correspond to what we -would like to refer to. For this reason, \cs{pnthechapternextnote} contains -the value of \cs{thechapter} at the point the ``next note'' is placed (a -\cs{postnote}, that is), the first in the chapter, and already inside it, thus -with an expected value of the \texttt{chapter} counter. Similarly, -\cs{pnthesectionnextnote} contains the value of \cs{thesection} for the ``next -note''. Of course, the ``next note'' variables are \emph{proxies}, but they -are meant to support the automation of the subdivision of the notes through -the use of \texttt{before} hooks to the document's sectioning commands, in -which case the subdivision of the notes will correspond to the document's -structure and, given empty notes sections are skipped, the values will be the -ones we are interested in. But more complex use cases may require something -different. Either way, it is up to the user to judge whether the \emph{proxy} -is a good one for their use case, the variables just do what they say, and -contain the values of interest for the ``next note''. +point it's content gets expanded by means of some variables (you can use +\cs{postnotesectionx} instead, in which case these variables are of little +use). When the content of a notes section gets typeset, \cs{pnthechapter} +contains the value of \cs{thechapter} where \cs{postnotesection} was +originally called. Similarly, \cs{pnthesection} contains the value of +\cs{thesection}. \cs{pnthechapternextnote} and \cs{pnthesectionnextnote} are +meant to support the automation of the notes subdivision by using hooks to +sectioning commands, which is a quite natural way to do this. However, since +it may be problematic to hook \emph{after} sectioning commands -- +\cs{section}, for example, figures prominently in the documentation of +\pkg{ltcmdhooks} as a case of ``look ahead'' command for which the +\texttt{after} hook is not supported -- we will typically want to hook +\emph{before} them. But, at this point the values of the \texttt{chapter} or +\texttt{section} counters have not yet been stepped, therefore \cs{thechapter} +and \cs{thesection} do not correspond to what we would like to refer to. For +this reason, \cs{pnthechapternextnote} contains the value of \cs{thechapter} +at the point the ``next note'' is placed (a \cs{postnote}, that is), the first +in the chapter, and already inside it, thus with an expected value of the +\texttt{chapter} counter. Similarly, \cs{pnthesectionnextnote} contains the +value of \cs{thesection} for the ``next note''. Of course, the ``next note'' +variables are \emph{proxies}, but they are meant to support the automation of +the subdivision of the notes through the use of \texttt{before} hooks to the +document's sectioning commands, in which case the subdivision of the notes +will correspond to the document's structure and, given empty notes sections +are skipped, the values will be the ones we are interested in. But more +complex use cases may require something different. Either way, it is up to +the user to judge whether the \emph{proxy} is a good one for their use case, +the variables just do what they say, and contain the values of interest for +the ``next note''. This is meant to be simple. Some examples might make things more concrete. At its most basic, \cs{postnotesection} can just be set manually: @@ -820,9 +825,9 @@ don't have to worry about them. These strings will automatically adjust to the document language, set either by \pkg{babel} or by \pkg{polyglossia}, \emph{if} the language is supported by -\pkg{postnotes}. Currently supported are English and Portuguese, and their -variants. Either way, you can always change these variables to the values of -your preference. If you are not using either \pkg{babel} or +\pkg{postnotes}. Currently supported are English, French, Portuguese, and +their variants. Either way, you can always change these variables to the +values of your preference. If you are not using either \pkg{babel} or \pkg{polyglossia}, you can do so directly, for example, with: \begin{pnsnippet} \renewcommand*{\pntitle}{My title} @@ -953,6 +958,10 @@ provided by (in chronological order): and Moritz Wemheuer. % 2022-04-05: https://tex.stackexchange.com/q/597359#comment1594585_597389 +The package's language support have been provided or improved thanks to: + `\texttt{Pika78}' (French). + % 2022-04-25: https://github.com/gusbrs/postnotes/issues/1#issuecomment-1108634938 + If I have inadvertently left anyone off the list I apologize, and please let me know, so that I can correct the oversight. |