summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/multicolrule
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-12-18 23:36:36 +0000
committerKarl Berry <karl@freefriends.org>2018-12-18 23:36:36 +0000
commit0ea59c8de700d750b4b5186b6d374c443d327915 (patch)
tree1164feaa97daaadeeaf80829056f6d4870f85179 /Master/texmf-dist/tex/latex/multicolrule
parent25f0a34ef212818e30ee07866877d0ea7985c691 (diff)
multicolrule (18dec18)
git-svn-id: svn://tug.org/texlive/trunk@49451 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/multicolrule')
-rw-r--r--Master/texmf-dist/tex/latex/multicolrule/multicolrule.sty297
1 files changed, 297 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/multicolrule/multicolrule.sty b/Master/texmf-dist/tex/latex/multicolrule/multicolrule.sty
new file mode 100644
index 00000000000..bfb62d6e86e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/multicolrule/multicolrule.sty
@@ -0,0 +1,297 @@
+%%
+%% This is file `multicolrule.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% multicolrule.dtx (with options: `package')
+%% ----------------------------------------------------------------
+%% multicolrule --- Decorative rules between columns
+%% Author: Karl Hagen
+%% Email: latex@polysyllabic.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\RequirePackage{expl3}
+\RequirePackage{xparse}
+\ProvidesExplPackage {multicolrule} {2018/12/18} {1.0}
+{Decorative~vertical~rules~between~columns}
+\RequirePackage{l3keys2e}
+\RequirePackage{xpatch}
+\RequirePackage{xcolor}
+\msg_new:nnn {multicolrule} {patch-success} {Patched~#1.}
+\msg_new:nnn {multicolrule} {patch-failure} {Error~patching~#1.}
+\msg_new:nnn {multicolrule} {tikz-required}
+{The~'#1'~setting~requires~tikz~to~work.~Either~load~tikz~before~you~load~
+ multicolrule~or~use~multicolrule's~'tikz'~package~option.}
+\msg_new:nnn {multicolrule} {multicol-loaded} {You~are~using~the~'twocolumn'~
+ option~with~multicol~already~loaded.~You~will~likely~run~into~problems.}
+\bool_new:N \g__mcrule_twocolumn_bool
+\bool_new:N \g__mcrule_use_tikz_bool
+\int_new:N \l__mcrule_repeat_int
+\int_set:Nn \l__mcrule_repeat_int {1}
+\dim_new:N \l__mcrule_repeat_distance_dim
+\tl_new:N \l__mcrule_color_name_tl
+\tl_new:N \l__mcrule_color_model_tl
+\@ifpackageloaded{tikz}
+{
+ \bool_gset_true:N \g__mcrule_use_tikz_bool
+}{}
+\keys_define:nn {mcrule-opts}
+{
+ twocolumn .bool_gset:N = \g__mcrule_twocolumn_bool,
+ tikz .bool_gset:N = \g__mcrule_use_tikz_bool,
+ tikz .default:n = true,
+}
+\ProcessKeysOptions{mcrule-opts}
+\cs_new:Npn \__mcrule_col_box: {}
+\bool_if:NTF \g__mcrule_twocolumn_bool
+{
+ \@ifpackageloaded{multicol}
+ {
+ \msg_warning:nn {multicolrule} {multicol-loaded}
+ }
+ \cs_gset:Npn \columnseprulecolor {\normalcolor}
+ \cs_gset:Npn \__mcrule_col_box: {\@outputbox}
+ \xpatchcmd{\@outputdblcol} {\normalcolor\vrule\@width\columnseprule}
+ {\columnseprulecolor\mcruledivider}
+ {
+ \msg_info:nnn {multicolrule} {patch-success} {\@outputdblcol}
+ }
+ {
+ \msg_info:nnn {multicolrule} {patch-failure} {\@outputdblcol}
+ }
+}
+{
+ \RequirePackage{multicol}
+ \cs_gset:Npn \__mcrule_col_box: {\mult@rightbox}
+ % Patch the code in multicol that creates the vertical rule.
+ \xpatchcmd{\LR@column@boxes} {\vrule\@width\columnseprule} {\mcruledivider}
+ {\msg_info:nnn {multicolrule} {patch-success} {\LR@column@boxes}}
+ {\msg_info:nnn {multicolrule} {patch-failure} {\LR@column@boxes}}
+ \xpatchcmd{\RL@column@boxes} {\vrule\@width\columnseprule} {\mcruledivider}
+ {\msg_info:nnn {multicolrule} {patch-success} {\RL@column@boxes}}
+ {\msg_info:nnn {multicolrule} {patch-failure} {\RL@column@boxes}}
+ \LRmulticolcolumns
+}
+\cs_new:Npn \mcruledivider
+{
+ \bool_lazy_and:nnT
+ {\dim_compare_p:nNn {\columnseprule} > {0pt}}
+ {\int_compare_p:nNn {\l__mcrule_repeat_int} > {0}}
+ {
+ \__mcrule_divider:
+ \prg_replicate:nn {\l__mcrule_repeat_int - 1}
+ {
+ \hspace{\l__mcrule_repeat_distance_dim}
+ \__mcrule_divider:
+ }
+ }
+}
+\cs_new:Npn \__mcrule_divider: {\vrule\@width\columnseprule}
+\cs_new_nopar:Npn \__mcrule_pattern:nnn #1#2#3
+{
+ \vbox_to_ht:nn {\box_ht:N \__mcrule_col_box:}
+ { \vfill
+ \kern #2 \hbox:n{#1} \kern #3
+ \vfill
+ }
+}
+\cs_new_nopar:Npn \__mcrule_tile_pattern:nnn #1#2#3
+{
+ \vbox_to_ht:nn {\box_ht:N \__mcrule_col_box:}
+ {
+ \cleaders \vbox:n {
+ \kern #2 \hbox:n{#1} \kern #3
+ }\vfill
+ }
+}
+\cs_new:Npn \__mcrule_line_pattern:nnnn #1#2#3#4
+{
+ \bool_if:NTF \g__mcrule_use_tikz_bool
+ {
+ \__mcrule_pattern_line:n {#1}
+ }
+ {
+ \__mcrule_tile_pattern:nnn {\rule{\columnseprule}{#2}}{#3}{#4}
+ }
+}
+\bool_if:NTF \g__mcrule_use_tikz_bool
+{
+ \ExplSyntaxOff
+ \RequirePackage{tikz}
+ \ExplSyntaxOn
+ \cs_set:Npn \__mcrule_tikz_picture:n #1
+ {
+ \__mcrule_tikz_picture:nx {#1} {\__mcrule_col_box:}
+ }
+ \cs_set:Npn \__mcrule_tikz_picture:nn #1#2
+ {
+ \begin{tikzpicture}[x=1pt,y=1pt,inner~sep=0pt,outer~sep=0pt]
+ \node (TOP) at (0,\ht#2) {};
+ \node (BOT) at (0,0) {};
+ #1
+ \end{tikzpicture}
+ }
+ \cs_generate_variant:Nn \__mcrule_tikz_picture:nn {nx}
+ \cs_set:Npn \__mcrule_pattern_line:n #1
+ {
+ \__mcrule_pattern_line:nx {#1} {\__mcrule_col_box:}
+ }
+ \cs_set:Npn \__mcrule_pattern_line:nn #1#2
+ {
+ \begin{tikzpicture}[x=1pt,y=1pt,inner~sep=0pt,outer~sep=0pt]
+ \draw[line~width=\columnseprule,#1] (0,\ht#2) -- (0,0);
+ \end{tikzpicture}
+ }
+ \cs_generate_variant:Nn \__mcrule_pattern_line:nn {nx}
+ \cs_set:Npn \__mcrule_circle:
+ {
+ \begin{tikzpicture}[x=1pt,y=1pt,inner~sep=0pt,outer~sep=0pt]
+ \draw (0,0) circle[radius=.5\columnseprule];
+ \end{tikzpicture}
+ }
+ \cs_set:Npn \__mcrule_solid_circle:
+ {
+ \begin{tikzpicture}[x=1pt,y=1pt,inner~sep=0pt,outer~sep=0pt]
+ \fill (0,0) circle[radius=.5\columnseprule];
+ \end{tikzpicture}
+ }
+}
+{
+ \cs_set:Npn \__mcrule_tikz_picture:n #1
+ {\msg_error:nnn {multicolrule} {tikz-required} {#1}}
+ \cs_new:Npn \__mcrule_pattern_line:n #1
+ {\msg_error:nnn {multicolrule} {tikz-required} {#1}}
+ \cs_new:Npn \__mcrule_circle:
+ {\msg_error:nnn {multicolrule} {tikz-required} {circles}}
+ \cs_new:Npn \__mcrule_solid_circle:
+ {\msg_error:nnn {multicolrule} {tikz-required} {solid-circles}}
+}
+\cs_new_protected:Npn \__mcrule_set_rule_color:
+{
+ \tl_if_empty:NT \l__mcrule_color_name_tl
+ {
+ \tl_set:Nn \l__mcrule_color_name_tl {black}
+ }
+ \tl_if_empty:NTF \l__mcrule_color_model_tl
+ {
+ \cs_set:Npn \columnseprulecolor {\color{\l__mcrule_color_name_tl}}
+ }
+ {
+ \cs_set:Npn \columnseprulecolor
+ {\color[\l__mcrule_color_model_tl]{\l__mcrule_color_name_tl}}
+ }
+}
+\keys_define:nn {mcrule}
+{
+ line-style .choice:,
+ line-style / solid .code:n = \cs_set:Npn \__mcrule_divider:
+ {\vrule\@width\columnseprule},
+ line-style / dots .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {.}{1pt}{1pt}},
+ line-style / dense-dots .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {.}{1pt}{0pt}},
+ line-style / loose-dots .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {.}{2pt}{2pt}},
+ line-style / circles .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {\__mcrule_circle:}{1pt}{1pt}},
+ line-style / dense-circles .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {\__mcrule_circle:}{1pt}{0pt}},
+ line-style / loose-circles .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {\__mcrule_circle:}{2pt}{2pt}},
+ line-style / solid-circles .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {\__mcrule_solid_circle:}{1pt}{1pt}},
+ line-style / dense-solid-circles .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {\__mcrule_solid_circle:}{1pt}{0pt}},
+ line-style / loose-solid-circles .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn {\__mcrule_solid_circle:}{2pt}{2pt}},
+ line-style / dotted .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_line_pattern:nnnn {dotted}{\columnseprule}{1pt}{1pt}},
+ line-style / densely-dotted .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_line_pattern:nnnn {densely~dotted}{\columnseprule}{1pt}{0pt}},
+ line-style / loosely-dotted .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_line_pattern:nnnn {loosely~dotted}{\columnseprule}{2pt}{2pt}},
+ line-style / dashed .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_line_pattern:nnnn {dashed}{3pt}{1.5pt}{1.5pt}},
+ line-style / densely-dashed .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_line_pattern:nnnn {densely~dashed}{3pt}{1pt}{1pt}},
+ line-style / loosely-dashed .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_line_pattern:nnnn {loosely~dashed}{3pt}{3pt}{3pt}},
+ line-style / dash-dot .code:n =
+ \cs_set:Npn \__mcrule_divider: {\__mcrule_pattern_line:n{dash~dot}},
+ line-style / densely-dash-dot .code:n =
+ \cs_set:Npn \__mcrule_divider: {\__mcrule_pattern_line:n{densely~dash~dot}},
+ line-style / loosely-dash-dot .code:n =
+ \cs_set:Npn \__mcrule_divider: {\__mcrule_pattern_line:n{loosely~dash~dot}},
+ line-style / dash-dot-dot .code:n =
+ \cs_set:Npn \__mcrule_divider: {\__mcrule_pattern_line:n{dash~dot~dot}},
+ line-style / densely-dash-dot-dot .code:n =
+ \cs_set:Npn \__mcrule_divider: {\__mcrule_pattern_line:n{densely~dash~dot~dot}},
+ line-style / loosely-dash-dot-dot .code:n =
+ \cs_set:Npn \__mcrule_divider: {\__mcrule_pattern_line:n{loosely~dash~dot~dot}},
+ color .code:n = {
+ \tl_set:Nn \l__mcrule_color_name_tl {#1}
+ \__mcrule_set_rule_color:
+ },
+ color-model .code:n = {
+ \tl_set:Nn \l__mcrule_color_model_tl {#1}
+ \__mcrule_set_rule_color:
+ },
+ custom-line .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tikz_picture:n {#1}},
+ custom-pattern .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_pattern:nnn #1},
+ custom-tile .code:n = \cs_set:Npn \__mcrule_divider:
+ {\__mcrule_tile_pattern:nnn #1},
+ width .choice:,
+ width / ultra-thin .code:n = \dim_set:Nn \columnseprule {0.1pt},
+ width / very-thin .code:n = \dim_set:Nn \columnseprule {0.2pt},
+ width / thin .code:n = \dim_set:Nn \columnseprule {0.4pt},
+ width / semithick .code:n = \dim_set:Nn \columnseprule {0.6pt},
+ width / thick .code:n = \dim_set:Nn \columnseprule {0.8pt},
+ width / very-thick .code:n = \dim_set:Nn \columnseprule {1.2pt},
+ width / ultra-thick .code:n = \dim_set:Nn \columnseprule {1.6pt},
+ width / unknown .code:n = {\dim_set:Nn \columnseprule {#1}},
+ repeat .int_set:N = \l__mcrule_repeat_int,
+ repeat-distance .dim_set:N = \l__mcrule_repeat_distance_dim,
+ single .meta:n = {
+ repeat = 1,
+ repeat-distance = #1
+ },
+ single .default:n = \columnseprule,
+ double .meta:n = {
+ repeat = 2,
+ repeat-distance = #1
+ },
+ double .default:n = \columnseprule,
+ triple .meta:n = {
+ repeat = 3,
+ repeat-distance = #1
+ },
+ triple .default:n = \columnseprule,
+}
+\NewDocumentCommand{\SetMCRule}{m}
+{
+ \keys_set:nn {mcrule} {#1}
+}
+%% Copyright (C) 2018 by Karl Hagen <latex@polysyllabic.com>
+%%
+%% This file may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License (LPPL), either
+%% version 1.3 of this license or (at your option) any later
+%% version. The latest version of this license is in the file:
+%% https://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status) by
+%% Karl Hagen.
+%%
+%% This work consists of the files multicolrule.dtx and
+%% mcrule-examples.tex,
+%% and the derived files multicolrule.ins,
+%% multicolrule.sty,
+%% multicolrule.pdf, and
+%% mcrule-examples.pdf.
+%%
+%% End of file `multicolrule.sty'.