summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/dashrule
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-08-14 23:55:38 +0000
committerKarl Berry <karl@freefriends.org>2009-08-14 23:55:38 +0000
commit30d401dbe76f4a5e3e7d6edf4d8af9a5a279e836 (patch)
tree122dee55995bd358367bd89f55717c41f2a96822 /Master/texmf-dist/source/latex/dashrule
parent0d16b3b7e2ce00f9de58a809a4ce47b39aaef068 (diff)
dashrule update (9aug09)
git-svn-id: svn://tug.org/texlive/trunk@14681 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/dashrule')
-rw-r--r--Master/texmf-dist/source/latex/dashrule/dashrule.dtx91
-rw-r--r--Master/texmf-dist/source/latex/dashrule/dashrule.ins4
2 files changed, 61 insertions, 34 deletions
diff --git a/Master/texmf-dist/source/latex/dashrule/dashrule.dtx b/Master/texmf-dist/source/latex/dashrule/dashrule.dtx
index 1e5b1470e7e..809ccf7d306 100644
--- a/Master/texmf-dist/source/latex/dashrule/dashrule.dtx
+++ b/Master/texmf-dist/source/latex/dashrule/dashrule.dtx
@@ -22,12 +22,12 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{dashrule}
%<*package>
- [2008/04/27 v1.1 Dashed rules]
+ [2009/08/09 v1.2 Dashed rules]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
-\usepackage{dashrule}[2008/04/27]
+\usepackage{dashrule}
\usepackage{titlesec}
\EnableCrossrefs
\CodelineIndex
@@ -40,7 +40,7 @@
%</driver>
% \fi
%
-% \CheckSum{62}
+% \CheckSum{64}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -137,8 +137,9 @@
% 2\,pt.\ rule, followed by a 1\,pt.\ gap, followed by a 2\,pt.\ rule,
% followed by a 1\,pt.\ gap, and so forth. An odd number of
% \meta{dimen}s is no different; ``|2pt|'' alternates 2\,pt.\ rules and
-% 2\,pt.\ gaps, and ``|1pt 2pt 3pt|'' repeats ``1\,pt.\ rule, 2\,pt.\
-% gap, 3\,pt.\ rule, 1\,pt.\ gap, 2\,pt.\ rule, 3\,pt.\ gap.''
+% 2\,pt.\ gaps, and ``|1pt 2pt 3pt|'' repeats ``1\,pt.\ rule,
+% 2\,pt.\ gap, 3\,pt.\ rule, 1\,pt.\ gap, 2\,pt.\ rule, 3\,pt.\ gap.''
+% As a special case, an empty \meta{dash} argument draws a solid rule.
%
%
% \section{Examples}
@@ -152,7 +153,13 @@
% \renewcommand{\arraystretch}{1.5}
% \newcommand{\chg}[1]{\underbar{\texttt{#1}}}
% \begin{tabular}{l@{\qquad}l}
-% |\hdashrule{2cm}{1pt}{1pt}| &
+% |\rule{2cm}{1pt}| &
+% X\rule{2cm}{1pt}x \\
+%
+% |\|\chg{hdashrule}|{2cm}{1pt}|\chg{\char`\{\char`\}} &
+% X\hdashrule{2cm}{1pt}{}x \\
+%
+% |\hdashrule{2cm}{1pt}{|\chg{1pt}|}| &
% X\hdashrule{2cm}{1pt}{1pt}x \\
%
% |\hdashrule{|\chg{4cm}|}{1pt}{1pt}| &
@@ -183,6 +190,7 @@
%
% \begin{center}
% \renewcommand{\arraystretch}{1.25}
+% \newcommand{\chg}[1]{\underbar{\texttt{#1}}}
% \begin{tabular}{l@{\qquad}l}
% |\hdashrule[0.5ex]{4cm}{1mm}{8mm 2pt}| &
% X\hdashrule[0.5ex]{4cm}{1mm}{8mm 2pt}x \\
@@ -190,16 +198,16 @@
% |\hdashrule[0.5ex]{3cm}{1mm}{8mm 2pt}| &
% X\hdashrule[0.5ex]{3cm}{1mm}{8mm 2pt}x \\[2ex]
%
-% |\hdashrule[0.5ex][c]{4cm}{1mm}{8mm 2pt}| &
+% |\hdashrule[0.5ex]|\chg{[c]}|{4cm}{1mm}{8mm 2pt}| &
% X\hdashrule[0.5ex][c]{4cm}{1mm}{8mm 2pt}x \\
%
-% |\hdashrule[0.5ex][c]{3cm}{1mm}{8mm 2pt}| &
+% |\hdashrule[0.5ex]|\chg{[c]}|{3cm}{1mm}{8mm 2pt}| &
% X\hdashrule[0.5ex][c]{3cm}{1mm}{8mm 2pt}x \\[2ex]
%
-% |\hdashrule[0.5ex][x]{4cm}{1mm}{8mm 2pt}| &
+% |\hdashrule[0.5ex][|\chg{x}|]{4cm}{1mm}{8mm 2pt}| &
% X\hdashrule[0.5ex][x]{4cm}{1mm}{8mm 2pt}x \\
%
-% |\hdashrule[0.5ex][x]{3cm}{1mm}{8mm 2pt}| &
+% |\hdashrule[0.5ex][|\chg{x}|]{3cm}{1mm}{8mm 2pt}| &
% X\hdashrule[0.5ex][x]{3cm}{1mm}{8mm 2pt}x \\
% \end{tabular}
% \end{center}
@@ -240,9 +248,6 @@
% parameter to specify a starting offset into the pattern. If you're
% desperate you can fake \textit{offset} with a leading |\rule| and
% |\hspace|.
-%
-% \item Unlike |setdash|, |\hdashrule| can't draw a solid line. Use
-% |\rule| for solid lines.
% \end{itemize}
%
%
@@ -271,6 +276,12 @@
%<*package>
% \end{macrocode}
%
+% We load the \textsf{ifmtarg} package to help check if the final
+% argument to |\hdashrule| is empty.
+% \begin{macrocode}
+\RequirePackage{ifmtarg}
+% \end{macrocode}
+%
% \begin{macro}{\hdr@do@rule}
% This macro is exactly like \LaTeX's |\rule| except that the optional
% argument is required, and it has the side effect of pointing
@@ -367,11 +378,22 @@
% \end{macrocode}
% \end{macro}
%
+% If the final argument, \meta{dash}, is empty, we fall back to using an
+% ordinary |\rule| command. This is not terribly useful in practice but
+% does make |\hdashrule| behave more like PostScript's |setdash|.
+% \begin{macrocode}
+ \@ifmtarg{#5}{%
+ \rule[#1]{#3}{#4}%
+ }{%
+% \end{macrocode}
+% Here begins the common case, in which the \meta{dash} argument is
+% nonempty.
+%
% \begin{macro}{\hdr@do@something}
% The |\hdr@do@something| alias alternates between |\hdr@do@rule|
% and |\hdr@do@skip|, starting with |\hdr@do@rule|.
% \begin{macrocode}
- \let\hdr@do@something=\hdr@do@rule
+ \let\hdr@do@something=\hdr@do@rule
% \end{macrocode}
% \end{macro}
%
@@ -381,19 +403,19 @@
% define |\hdr@parse@dash| within |\hdashrule@ii| so we don't have to
% pass in |\hdashrule@ii|'s~|#1| and~|#4| on every invocation.
% \begin{macrocode}
- \def\hdr@parse@dash##1 {%
- \ifx##1!%
- \else
- \hdr@do@something[#1]{##1}{#4}%
- \expandafter\hdr@parse@dash
- \fi
- }%
+ \def\hdr@parse@dash##1 {%
+ \ifx##1!%
+ \else
+ \hdr@do@something[#1]{##1}{#4}%
+ \expandafter\hdr@parse@dash
+ \fi
+ }%
% \end{macrocode}
% We now count the number of segments in the dash pattern so we can
% determine if we have an even or odd number of them.
% \begin{macrocode}
- \setcounter{hdr@segments}{0}%
- \hdr@tally@segments#5 !
+ \setcounter{hdr@segments}{0}%
+ \hdr@tally@segments#5 !
% \end{macrocode}
% Finally, we invoke |\leaders|, |\cleaders|, or |\xleaders| to draw the
% dashed line, repeating the pattern until \meta{width} space is filled.
@@ -407,16 +429,21 @@
% inferior results because \TeX's various leader commands do not split
% boxes. The longer the pattern, the less likely it will fit snugly
% into the given width.
+% \changes{v1.2}{2009/08/08}{Ended the rule with an empty box to enable
+% \texttt{\string\string\string\hdashrule} to work within a
+% \texttt{tabular} cell. Thanks to Piazza Luca for the bug report}
% \begin{macrocode}
- \ifodd\c@hdr@segments
- \csname#2leaders\endcsname
- \hbox{\hdr@parse@dash#5 #5 ! }%
- \hskip#3\relax
- \else
- \csname#2leaders\endcsname
- \hbox{\hdr@parse@dash#5 ! }%
- \hskip#3\relax
- \fi
+ \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{}%
+ }%
}
% \end{macrocode}
% \end{macro}
diff --git a/Master/texmf-dist/source/latex/dashrule/dashrule.ins b/Master/texmf-dist/source/latex/dashrule/dashrule.ins
index e5018aec9b6..7a55b553fe7 100644
--- a/Master/texmf-dist/source/latex/dashrule/dashrule.ins
+++ b/Master/texmf-dist/source/latex/dashrule/dashrule.ins
@@ -1,5 +1,5 @@
%%
-%% Copyright (C) 2008 by Scott Pakin <scott+dash@pakin.org>
+%% Copyright (C) 2009 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
@@ -21,7 +21,7 @@
This is a generated file.
-Copyright (C) 2008 by Scott Pakin <scott+dash@pakin.org>
+Copyright (C) 2009 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