summaryrefslogtreecommitdiff
path: root/macros/latex/contrib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-03-17 03:01:42 +0000
committerNorbert Preining <norbert@preining.info>2024-03-17 03:01:42 +0000
commit55140d5421e1ad0024c9acbfa72bd06402c2aa9f (patch)
treeb6c0d76888f025b58f1221d8dadbefb0264e9f6c /macros/latex/contrib
parent966f9ba332e49c29e961cb86e08f97d70eda51f6 (diff)
CTAN sync 202403170301
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r--macros/latex/contrib/dashrulex/README.md7
-rw-r--r--macros/latex/contrib/dashrulex/dashrulex.pdfbin0 -> 54472 bytes
-rw-r--r--macros/latex/contrib/dashrulex/dashrulex.sty49
-rw-r--r--macros/latex/contrib/dashrulex/dashrulex.tex81
4 files changed, 137 insertions, 0 deletions
diff --git a/macros/latex/contrib/dashrulex/README.md b/macros/latex/contrib/dashrulex/README.md
new file mode 100644
index 0000000000..c0e441ac99
--- /dev/null
+++ b/macros/latex/contrib/dashrulex/README.md
@@ -0,0 +1,7 @@
+# The dashrulex package
+
+The `dashrulex` package provides a flexible solution for drawing dashed rules in the body, and currently provides two commands `\hdashrule` and `\hanyrule`. It's written in LaTeX3 and can be used as an alternative to the `dashrule` package.
+
+## License
+
+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 \ No newline at end of file
diff --git a/macros/latex/contrib/dashrulex/dashrulex.pdf b/macros/latex/contrib/dashrulex/dashrulex.pdf
new file mode 100644
index 0000000000..71e4597be0
--- /dev/null
+++ 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
new file mode 100644
index 0000000000..aba9f203d3
--- /dev/null
+++ b/macros/latex/contrib/dashrulex/dashrulex.sty
@@ -0,0 +1,49 @@
+%
+% ***************** 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/16}{1.00}
+ {Customize superscripts and subscripts}
+\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}
+ {\rule[#1]{#3}{#2}\skip_horizontal:n {#3}}
+ {\rule[#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{}
+ }
+\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
new file mode 100644
index 0000000000..1d4ce592b9
--- /dev/null
+++ b/macros/latex/contrib/dashrulex/dashrulex.tex
@@ -0,0 +1,81 @@
+\documentclass[load-preamble+]{cnltx-doc}
+
+\usepackage{setspace,hologo,dashrulex}
+\usepackage[noto]{newtxmath}
+\setcnltx
+ {
+ package = dashrulex,
+ title = the dashrulex package,
+ version = v1.00,
+ date = 2024/03/16,
+ 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}\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 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 dashed rule, which can be set to \cs{fill} to indicate an arbitrarily long distance when you need to fill the entire horizontal center of the plate. \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 empty space, such as \code{5pt|2pt,3pt}, if the empty 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
+ \end{example}
+ \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}
+ 1X\hanyrule[]{5cm}{\makebox[6pt][l]{$\cdot$}}x \\
+ 2X\hanyrule[c]{5cm}{\makebox[6pt][l]{$\cdot$}}x \\
+ 3X\hanyrule[x]{5cm}{\makebox[6pt][l]{$\cdot$}}x \\
+ 4X\hanyrule[x]{5cm}{\makebox[6pt][c]{$\cdot$}}x \\
+ 5X\hanyrule[x]{5cm}{\makebox[6pt][c]{$\cdot$},\makebox[6pt]{$\circ$}}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