summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/dashrule/dashrule.sty
blob: e74cd3159e2e23531a3bafca038966fa6263fd57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
%%
%% This is file `dashrule.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% dashrule.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2013 by Scott Pakin <scott+dash@pakin.org>
%% 
%% This file 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 2006/05/20 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{dashrule}
    [2013/03/28 v1.3 Dashed rules]
\RequirePackage{ifmtarg}
\def\hdr@do@rule[#1]#2#3{%
  \rule[#1]{#2}{#3}%
  \let\hdr@do@something=\hdr@do@skip
}
\def\hdr@do@skip[#1]#2#3{%
  \hspace*{#2}%
  \let\hdr@do@something=\hdr@do@rule
}
\newcounter{hdr@segments}
\def\hdr@tally@segments#1 {%
  \ifx#1!%
  \else
    \addtocounter{hdr@segments}{1}%
    \expandafter\hdr@tally@segments
  \fi
}
\DeclareRobustCommand{\hdashrule}{\mbox{}\@testopt{\hdashrule@i}{0pt}}
\def\hdashrule@i[#1]{\@testopt{\hdashrule@ii[#1]}\empty}
\def\hdashrule@ii[#1][#2]#3#4#5{%
  \@ifmtarg{#5}{%
    \rule[#1]{#3}{#4}%
  }{%
    \let\hdr@do@something=\hdr@do@rule
    \def\hdr@parse@dash##1 {%
      \ifx##1!%
      \else
        \hdr@do@something[#1]{##1}{#4}%
        \expandafter\hdr@parse@dash
      \fi
    }%
    \setcounter{hdr@segments}{0}%
    \hdr@tally@segments#5 !
    \ifodd\c@hdr@segments
      \csname#2leaders\endcsname
        \hbox{\hdr@parse@dash#5 #5 ! }%
        \hskip#3%
    \else
      \csname#2leaders\endcsname
        \hbox{\hdr@parse@dash#5 ! }%
        \hskip#3%
    \fi
    \mbox{}%
  }%
}
\endinput
%%
%% End of file `dashrule.sty'.