summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/dashrulex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-03-26 03:03:59 +0000
committerNorbert Preining <norbert@preining.info>2024-03-26 03:03:59 +0000
commit904f56f2c26edc7eb11d5a27579bccbeca29c618 (patch)
tree8a4d6d2e163e93dd2c13a28db996b419aee856b4 /macros/latex/contrib/dashrulex
parent05f8146ef2eea2cd71b9c96583c6d893e6c76af5 (diff)
CTAN sync 202403260303
Diffstat (limited to 'macros/latex/contrib/dashrulex')
-rw-r--r--macros/latex/contrib/dashrulex/dashrulex.pdfbin58949 -> 58940 bytes
-rw-r--r--macros/latex/contrib/dashrulex/dashrulex.sty181
-rw-r--r--macros/latex/contrib/dashrulex/dashrulex.tex188
3 files changed, 184 insertions, 185 deletions
diff --git a/macros/latex/contrib/dashrulex/dashrulex.pdf b/macros/latex/contrib/dashrulex/dashrulex.pdf
index 5ed12594f6..376eb91c90 100644
--- a/macros/latex/contrib/dashrulex/dashrulex.pdf
+++ b/macros/latex/contrib/dashrulex/dashrulex.pdf
Binary files differ
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
diff --git a/macros/latex/contrib/dashrulex/dashrulex.tex b/macros/latex/contrib/dashrulex/dashrulex.tex
index fdb4fd69fc..c7db9dd89c 100644
--- a/macros/latex/contrib/dashrulex/dashrulex.tex
+++ b/macros/latex/contrib/dashrulex/dashrulex.tex
@@ -1,95 +1,95 @@
-\documentclass[load-preamble+]{cnltx-doc}
-
-\usepackage{setspace,hologo,dashrulex,tikz}
-\usepackage[noto]{newtxmath}
-\setcnltx
- {
- package = dashrulex,
- title = the dashrulex package,
- version = v1.00b,
- date = 2024/03/18,
- authors = Qu Yi,
- info = Draw dashed rules,
- email = toquyi@163.com,
- abstract =
- {
- The \pkg*{dashrulex} package provides a flexible solution for drawing dashed rules in the body, and currently provides two commands \cs{hdashrule} and \cs{hanyrule}. It's written in \hologo{LaTeX3} and can be used as an alternative to the \pkg*{dashrule} package.
- },
- color-scheme = blue,
- title-format = \huge\bfseries\scshape,
- listings-options = {numbers = none,gobble = 2,lineskip = 1pt},
- pre-output = {\parindent = 0em\setstretch{1.3}},
- before-skip = \smallskipamount,
- after-skip = \smallskipamount
- }
-\makeatletter
-\newcommand{\splitmeta}[3][\code{,}]{\meta{#2}#1\meta{#3}}
-\newcommand{\newsplitarg}[4][\splitmeta]
- {
- \newcommand{#2}[2]
- {\code{\textcolor{argument}{#3\textnormal{#1{##1}{##2}}#4}}}
- }
-\newcommand{\kvsplit}[3]
- {
- \item\code{\option{#1}\cnltx@isvalue\splitmarg{#2}{#3}}
- \cnltx@checkdefault{\hfill\newline}
- }
-\newsplitarg{\splitoarg}{[}{]}
-\newsplitarg{\splitmarg}{\{}{\}}
-\newsplitarg{\splitdarg}{(}{)}
-\newnote{\newtag}[1][New]{\textcolor{red}{\ding{73}\ #1}}
-\renewcommand{\emph}[1]{\textcolor{red}{#1}}
-\renewcommand{\cnltx@write@lastname}{}
-\makeatother
-
-\begin{document}
-\section{Preface}
-Sometimes it is necessary to draw dashed rules when writing documents, such as guides in the table of contents and indexes, horizontal lines in headers and footers, and even adding horizontal lines after headings. Macro packages such as \pkg*{dashrule} and \pkg*{nccrules} are available to accomplish this. Considering that \pkg*{dashrule} has not been updated for a long time, \pkg*{dashrulex} rewrites it using \hologo{LaTeX3} syntax and enhances it a bit.
-
-\section{User commands}
-\begin{commands}
- \command{hdashrule}[\oarg{raise}\oarg{leader}\marg{width}\marg{thickness list}\marg{dash rules}]
- The command to draw horizontal dashed rules, based on the \cs{rule} command, and the same as the \cs{rule} command when the \meta{dash rules} are empty. \meta{raise} is the vertical offset of the rule. \meta{leader} is the alignment of the dashed line fill, which can be empty, \code{c}, or \code{x} (the default), corresponding to the \cs{leaders}, \cs{cleaders}, and \cs{xleaders} commands, respectively. \meta{width} is the length of the dotted line, which can be set to \cs{fill} when used to fill the remaining center of the current text line. \meta{thickness list} is a rule for the height of vertically oriented lines, separated by \textcolor{red}{commas} and written as \splitmeta{height 1}{height a}\code{,...}, where \meta{height 1} denotes the height of a solid line and \meta{height a} denotes the height of a blank space.\meta{dash rules} is expressed as \splitmeta[\code{|}]{length 1}{length a}\code{,}\splitmeta[\code{|}]{length 2}{length b}\code{,...}, where \meta{length 1} represents the length of the solid line and \meta{length a} represents the length of the blank space, such as \code{5pt|2pt,3pt}, if the blank space is empty, then it is equal to the solid line length.
- \begin{example}
- 1X\rule{2cm}{1pt}x \\
- 2X\hdashrule{2cm}{1pt}{}x \\
- 3X\hdashrule{2cm}{1pt}{1pt}x \\
- 4X\hdashrule{4cm}{1pt}{1pt}x \\
- 5X\hdashrule[0.5ex]{4cm}{1pt}{1pt}x \\
- 6X\hdashrule[0.5ex]{4cm}{1pt}{3mm}x \\
- 7X\hdashrule[0.5ex]{4cm}{1mm}{3mm}x \\
- 8X\hdashrule[0.5ex]{4cm}{1mm}{3mm|3pt}x \\
- 9X\hdashrule[0.5ex]{4cm}{1mm}{3mm|3pt,1mm|2pt}x \\
- 10X\hdashrule[0.5ex]{4cm}{2pt,1pt,1pt}{3mm|3pt,1mm|2pt}x
- \end{example}
- \command{vrulemod}[\oarg{raise}\oarg{height}\oarg{depth}\marg{width}\marg{thickness list}]
- The vertical component used to fill the dashed line. \meta{thickness list} is consistent with the \cs{hdashrule} command, \meta{width} represents the length of the component, and the three optional parameters are consistent with those of the \cs{raisebox} command.
- \command{hanyrule}[\oarg{leader}\marg{width}\marg{symbol list}]
- This command sets the length of the dotted rule and fills it with arbitrary symbols. \meta{symbol list} can be more than one symbol and they are separated by \textcolor{red}{commas}. Symbols are best packed in boxes of a certain length, as spacing between symbols is not provided.
- \begin{example}
- \newcommand{\dblelement}
- {%
- \tikz[color=blue]
- {
- \draw[line width=0.8mm](0mm,1.1mm)--(3mm,1.1mm);
- \draw[line width=0.3mm](0mm,0mm)--(3mm,0mm);
- }%
- }
- 1X\hanyrule[]{5cm}{\makebox[8pt][l]{$\cdot$}}x \\
- 2X\hanyrule[c]{5cm}{\makebox[8pt][l]{$\cdot$}}x \\
- 3X\hanyrule[x]{5cm}{\makebox[8pt][l]{$\cdot$}}x \\
- 4X\hanyrule[c]{5cm}{\makebox[8pt]{$\cdot$}}x \\
- 5X\hanyrule[x]{5cm}{\makebox[8pt]{$\cdot$}}x \\
- 6X\hanyrule[x]{5cm}{\makebox[8pt]{$\cdot$},\makebox[8pt]{$\circ$}}x \\
- 7X\hanyrule[x]{5cm}{\makebox[5mm]{\vrulemod{3mm}{2pt,1pt,1pt}}}x \\
- 8X\hanyrule[x]{5cm}{\makebox[5mm]{\dblelement}}x
- \end{example}
-\end{commands}
-
-\section{Known issues}
-Currently only horizontal dashed line drawing is supported, with future plans to support vertical dashed lines, and even box dashed borders and so on.
-
-\appendix
-\nocite{*}
-
+\documentclass[load-preamble+]{cnltx-doc}
+
+\usepackage{setspace,hologo,dashrulex,tikz}
+\usepackage[noto]{newtxmath}
+\setcnltx
+ {
+ package = dashrulex,
+ title = the dashrulex package,
+ version = v1.00c,
+ date = 2024/03/25,
+ authors = Qu Yi,
+ info = Draw dashed rules,
+ email = toquyi@163.com,
+ abstract =
+ {
+ The \pkg*{dashrulex} package provides a flexible solution for drawing dashed rules in the body, and currently provides two commands \cs{hdashrule} and \cs{hanyrule}. It's written in \hologo{LaTeX3} and can be used as an alternative to the \pkg*{dashrule} package.
+ },
+ color-scheme = blue,
+ title-format = \huge\bfseries\scshape,
+ listings-options = {numbers = none,gobble = 2,lineskip = 1pt},
+ pre-output = {\parindent = 0em\setstretch{1.3}},
+ before-skip = \smallskipamount,
+ after-skip = \smallskipamount
+ }
+\makeatletter
+\newcommand{\splitmeta}[3][\code{,}]{\meta{#2}#1\meta{#3}}
+\newcommand{\newsplitarg}[4][\splitmeta]
+ {
+ \newcommand{#2}[2]
+ {\code{\textcolor{argument}{#3\textnormal{#1{##1}{##2}}#4}}}
+ }
+\newcommand{\kvsplit}[3]
+ {
+ \item\code{\option{#1}\cnltx@isvalue\splitmarg{#2}{#3}}
+ \cnltx@checkdefault{\hfill\newline}
+ }
+\newsplitarg{\splitoarg}{[}{]}
+\newsplitarg{\splitmarg}{\{}{\}}
+\newsplitarg{\splitdarg}{(}{)}
+\newnote{\newtag}[1][New]{\textcolor{red}{\ding{73}\ #1}}
+\renewcommand{\emph}[1]{\textcolor{red}{#1}}
+\renewcommand{\cnltx@write@lastname}{}
+\makeatother
+
+\begin{document}
+\section{Preface}
+Sometimes it is necessary to draw dashed rules when writing documents, such as guides in the table of contents and indexes, horizontal lines in headers and footers, and even adding horizontal lines after headings. Macro packages such as \pkg*{dashrule} and \pkg*{nccrules} are available to accomplish this. Considering that \pkg*{dashrule} has not been updated for a long time, \pkg*{dashrulex} rewrites it using \hologo{LaTeX3} syntax and enhances it a bit.
+
+\section{User commands}
+\begin{commands}
+ \command{hdashrule}[\oarg{raise}\oarg{leader}\marg{width}\marg{thickness list}\marg{dash rules}]
+ The command to draw horizontal dashed rules, based on the \cs{rule} command, and the same as the \cs{rule} command when the \meta{dash rules} are empty. \meta{raise} is the vertical offset of the rule. \meta{leader} is the alignment of the dashed line fill, which can be empty, \code{c}, or \code{x} (the default), corresponding to the \cs{leaders}, \cs{cleaders}, and \cs{xleaders} commands, respectively. \meta{width} is the length of the dotted line, which can be set to \cs{fill} when used to fill the remaining center of the current text line. \meta{thickness list} is a rule for the height of vertically oriented lines, separated by \textcolor{red}{commas} and written as \splitmeta{height 1}{height a}\code{,...}, where \meta{height 1} denotes the height of a solid line and \meta{height a} denotes the height of a blank space.\meta{dash rules} is expressed as \splitmeta[\code{|}]{length 1}{length a}\code{,}\splitmeta[\code{|}]{length 2}{length b}\code{,...}, where \meta{length 1} represents the length of the solid line and \meta{length a} represents the length of the blank space, such as \code{5pt|2pt,3pt}, if the blank space is empty, then it is equal to the solid line length.
+ \begin{example}
+ 1X\rule{2cm}{1pt}x \\
+ 2X\hdashrule{2cm}{1pt}{}x \\
+ 3X\hdashrule{2cm}{1pt}{1pt}x \\
+ 4X\hdashrule{4cm}{1pt}{1pt}x \\
+ 5X\hdashrule[0.5ex]{4cm}{1pt}{1pt}x \\
+ 6X\hdashrule[0.5ex]{4cm}{1pt}{3mm}x \\
+ 7X\hdashrule[0.5ex]{4cm}{1mm}{3mm}x \\
+ 8X\hdashrule[0.5ex]{4cm}{1mm}{3mm|3pt}x \\
+ 9X\hdashrule[0.5ex]{4cm}{1mm}{3mm|3pt,1mm|2pt}x \\
+ 10X\hdashrule[0.5ex]{4cm}{2pt,1pt,1pt}{3mm|3pt,1mm|2pt}x
+ \end{example}
+ \command{vrulemod}[\oarg{raise}\oarg{height}\oarg{depth}\marg{width}\marg{thickness list}]
+ The vertical component used to fill the dashed line. \meta{thickness list} is consistent with the \cs{hdashrule} command, \meta{width} represents the length of the component, and the three optional parameters are consistent with those of the \cs{raisebox} command.
+ \command{hanyrule}[\oarg{leader}\marg{width}\marg{symbol list}]
+ This command sets the length of the dotted rule and fills it with arbitrary symbols. \meta{symbol list} can be more than one symbol and they are separated by \textcolor{red}{commas}. Symbols are best packed in boxes of a certain length, as spacing between symbols is not provided.
+ \begin{example}
+ \newcommand{\dblvmod}
+ {%
+ \tikz[color=blue]
+ {
+ \draw[line width=0.8mm](0mm,1.1mm)--(3mm,1.1mm);
+ \draw[line width=0.3mm](0mm,0mm)--(3mm,0mm);
+ }%
+ }
+ 1X\hanyrule[]{5cm}{\makebox[8pt][l]{$\cdot$}}x \\
+ 2X\hanyrule[c]{5cm}{\makebox[8pt][l]{$\cdot$}}x \\
+ 3X\hanyrule[x]{5cm}{\makebox[8pt][l]{$\cdot$}}x \\
+ 4X\hanyrule[c]{5cm}{\makebox[8pt]{$\cdot$}}x \\
+ 5X\hanyrule[x]{5cm}{\makebox[8pt]{$\cdot$}}x \\
+ 6X\hanyrule[x]{5cm}{\makebox[8pt]{$\cdot$},\makebox[8pt]{$\circ$}}x \\
+ 7X\hanyrule[x]{5cm}{\makebox[5mm]{\vrulemod{3mm}{2pt,1pt,1pt}}}x \\
+ 8X\hanyrule[x]{5cm}{\makebox[5mm]{\dblvmod}}x
+ \end{example}
+\end{commands}
+
+\section{Known issues}
+Currently only horizontal dashed line drawing is supported, with future plans to support vertical dashed lines, and even box dashed borders and so on.
+
+\appendix
+\nocite{*}
+
\end{document} \ No newline at end of file