diff options
Diffstat (limited to 'macros/latex/contrib/dashrulex/dashrulex.sty')
-rw-r--r-- | macros/latex/contrib/dashrulex/dashrulex.sty | 181 |
1 files changed, 90 insertions, 91 deletions
diff --git a/macros/latex/contrib/dashrulex/dashrulex.sty b/macros/latex/contrib/dashrulex/dashrulex.sty index 58c104c0e1..86d43d1478 100644 --- a/macros/latex/contrib/dashrulex/dashrulex.sty +++ b/macros/latex/contrib/dashrulex/dashrulex.sty @@ -1,92 +1,91 @@ -% -% ***************** THE DASHRULEX PACKAGE ***************** -% -% Copyright (C) 2024 by Qu Yi <toquyi@163.com> -% -% This work may be distributed and/or modified under the -% conditions of the CC-BY 4.0 License. -% The latest version of this license is in -% https://creativecommons.org/licenses/by/4.0/legalcode -\NeedsTeXFormat{LaTeX2e}[2012/02/12] -\RequirePackage{xparse} -\ProvidesExplPackage{dashrulex}{2024/03/18}{1.00b} - {Draw dashed rules} -\DeclareDocumentCommand{\hdashrule}{O{0pt}O{x}mmm} - { - \tl_if_blank:nTF {#5} - { \rule[#1]{#3}{#4} } - { - \mbox{} - \use:c { #2leaders } - \hbox:n - { - \clist_map_inline:nn {#5} - { \drx@parse@dash{#1}{#4}{##1} } - } - \skip_horizontal:n {#3} - \mbox{} - } - } -\NewDocumentCommand{\drx@parse@dash} - {mm>{\SplitArgument{1}{|}}m} - {\drx@parse@dash@inner{#1}{#2}#3} -\cs_set_protected:Npn \drx@parse@dash@inner #1#2#3#4 - { - \IfNoValueTF{#4} - {\vrulemod[#1]{#3}{#2}\skip_horizontal:n {#3}} - {\vrulemod[#1]{#3}{#2}\skip_horizontal:n {#4}} - } -\NewDocumentCommand{\hanyrule}{O{x}mm} - { - \mbox{} - \use:c { #1leaders } - \hbox:n { \clist_map_inline:nn {#3} {##1} } - \skip_horizontal:n {#2} - \mbox{} - } - -\int_new:N \l__drx_vrule_counter_int -\int_set:Nn \l__drx_vrule_counter_int { 1 } -\dim_new:N \l__drx_vrule_height_dim -\tl_new:N \l__drx_tmpa_tl -\cs_new_protected:Npn \drx@step@counter@height #1 - { - \int_incr:N \l__drx_vrule_counter_int - \dim_add:Nn \l__drx_vrule_height_dim {#1} - } -\NewDocumentCommand{\vrulemod}{O{0pt}oomm} - { - \group_begin: - \IfValueTF{#2} - { - \tl_set:Nn \l__drx_tmpa_tl { [#2] } - \IfValueT{#3}{\tl_put_right:Nn \l__drx_tmpa_tl { [#3] }} - } - {\IfValueT{#3}{\tl_set:Nn \l__drx_tmpa_tl { [#3] }}} - \exp_last_unbraced:Nnf - \raisebox{#1}{\l__drx_tmpa_tl} - { - \clist_map_inline:nn {#5} - { - \int_compare:nNnTF { \l__drx_vrule_counter_int } > { 1 } - { - \int_if_even:nTF { \l__drx_vrule_counter_int } - { \drx@step@counter@height{##1} } - { - \kern -#4 - \exp_args:NV - \raisebox\l__drx_vrule_height_dim{\rule{#4}{##1}} - \drx@step@counter@height{##1} - } - } - { - \rule{#4}{##1} - \drx@step@counter@height{##1} - } - } - } - \group_end: - } -\endinput -% +%
+% ***************** THE DASHRULEX PACKAGE *****************
+%
+% Copyright (C) 2024 by Qu Yi <toquyi@163.com>
+%
+% This work may be distributed and/or modified under the
+% conditions of the CC-BY 4.0 License.
+% The latest version of this license is in
+% https://creativecommons.org/licenses/by/4.0/legalcode
+\NeedsTeXFormat{LaTeX2e}[2012/02/12]
+\RequirePackage{xparse}
+\ProvidesExplPackage{dashrulex}{2024/03/25}{1.00c}
+ {Draw dashed rules}
+\DeclareDocumentCommand{\hdashrule}{O{0pt}O{x}mmm}
+ {
+ \tl_if_blank:nTF {#5}
+ { \rule[#1]{#3}{#4} }
+ {
+ \mbox{}
+ \use:c { #2leaders }
+ \hbox:n
+ {
+ \clist_map_inline:nn {#5}
+ { \drx@parse@dash{#1}{#4}{##1} }
+ }
+ \skip_horizontal:n {#3}
+ \mbox{}
+ }
+ }
+\NewDocumentCommand{\drx@parse@dash}
+ {mm>{\SplitArgument{1}{|}}m}
+ {\drx@parse@dash@inner{#1}{#2}#3}
+\cs_set_protected:Npn \drx@parse@dash@inner #1#2#3#4
+ {
+ \IfNoValueTF{#4}
+ {\vrulemod[#1]{#3}{#2}\skip_horizontal:n {#3}}
+ {\vrulemod[#1]{#3}{#2}\skip_horizontal:n {#4}}
+ }
+\NewDocumentCommand{\hanyrule}{O{x}mm}
+ {
+ \mbox{}
+ \use:c { #1leaders }
+ \hbox:n { \clist_map_inline:nn {#3} {##1} }
+ \skip_horizontal:n {#2}
+ \mbox{}
+ }
+
+\int_new:N \l__drx_vrule_counter_int
+\int_set:Nn \l__drx_vrule_counter_int { 1 }
+\dim_new:N \l__drx_vrule_height_dim
+\tl_new:N \l__drx_tmpa_tl
+\cs_new_protected:Npn \drx@step@counter@height #1
+ {
+ \int_incr:N \l__drx_vrule_counter_int
+ \dim_add:Nn \l__drx_vrule_height_dim {#1}
+ }
+\NewDocumentCommand{\vrulemod}{O{0pt}oomm}
+ {
+ \group_begin:
+ \IfValueT{#2}
+ {
+ \tl_set:Nn \l__drx_tmpa_tl { [#2] }
+ \IfValueT{#3}{\tl_put_right:Nn \l__drx_tmpa_tl { [#3] }}
+ }
+ \exp_last_unbraced:Nnf
+ \raisebox{#1}{\l__drx_tmpa_tl}
+ {
+ \clist_map_inline:nn {#5}
+ {
+ \int_compare:nNnTF { \l__drx_vrule_counter_int } > { 1 }
+ {
+ \int_if_even:nTF { \l__drx_vrule_counter_int }
+ { \drx@step@counter@height{##1} }
+ {
+ \kern -#4
+ \exp_args:NV
+ \raisebox\l__drx_vrule_height_dim{\rule{#4}{##1}}
+ \drx@step@counter@height{##1}
+ }
+ }
+ {
+ \rule{#4}{##1}
+ \drx@step@counter@height{##1}
+ }
+ }
+ }
+ \group_end:
+ }
+\endinput
+%
% End of file `dashrulex.sty'.
\ No newline at end of file |