From 30d401dbe76f4a5e3e7d6edf4d8af9a5a279e836 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 14 Aug 2009 23:55:38 +0000 Subject: dashrule update (9aug09) git-svn-id: svn://tug.org/texlive/trunk@14681 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/dashrule/README | 2 +- Master/texmf-dist/doc/latex/dashrule/dashrule.pdf | Bin 277683 -> 139284 bytes .../texmf-dist/source/latex/dashrule/dashrule.dtx | 91 +++++++++++++-------- .../texmf-dist/source/latex/dashrule/dashrule.ins | 4 +- Master/texmf-dist/tex/latex/dashrule/dashrule.sty | 42 ++++++---- 5 files changed, 86 insertions(+), 53 deletions(-) diff --git a/Master/texmf-dist/doc/latex/dashrule/README b/Master/texmf-dist/doc/latex/dashrule/README index ab6b47ae490..b4e2c70868a 100644 --- a/Master/texmf-dist/doc/latex/dashrule/README +++ b/Master/texmf-dist/doc/latex/dashrule/README @@ -36,7 +36,7 @@ information on installing packages. Copyright and license --------------------- -Copyright (C) 2008 Scott Pakin, scott+dash@pakin.org +Copyright (C) 2009 Scott Pakin, scott+dash@pakin.org This package may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this diff --git a/Master/texmf-dist/doc/latex/dashrule/dashrule.pdf b/Master/texmf-dist/doc/latex/dashrule/dashrule.pdf index 8d7a89c0475..142517bd21d 100644 Binary files a/Master/texmf-dist/doc/latex/dashrule/dashrule.pdf and b/Master/texmf-dist/doc/latex/dashrule/dashrule.pdf differ 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 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{dashrule} %<*package> - [2008/04/27 v1.1 Dashed rules] + [2009/08/09 v1.2 Dashed rules] % % %<*driver> \documentclass{ltxdoc} -\usepackage{dashrule}[2008/04/27] +\usepackage{dashrule} \usepackage{titlesec} \EnableCrossrefs \CodelineIndex @@ -40,7 +40,7 @@ % % \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 +%% Copyright (C) 2009 by Scott Pakin %% %% 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 +Copyright (C) 2009 by Scott Pakin This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license diff --git a/Master/texmf-dist/tex/latex/dashrule/dashrule.sty b/Master/texmf-dist/tex/latex/dashrule/dashrule.sty index bc0d0919d0e..f9d60301ef9 100644 --- a/Master/texmf-dist/tex/latex/dashrule/dashrule.sty +++ b/Master/texmf-dist/tex/latex/dashrule/dashrule.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2008 by Scott Pakin +%% Copyright (C) 2009 by Scott Pakin %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3c of this license @@ -22,7 +22,8 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{dashrule} - [2008/04/27 v1.1 Dashed rules] + [2009/08/09 v1.2 Dashed rules] +\RequirePackage{ifmtarg} \def\hdr@do@rule[#1]#2#3{% \rule[#1]{#2}{#3}% \let\hdr@do@something=\hdr@do@skip @@ -42,25 +43,30 @@ \DeclareRobustCommand{\hdashrule}{\mbox{}\@testopt{\hdashrule@i}{0pt}} \def\hdashrule@i[#1]{\@testopt{\hdashrule@ii[#1]}\empty} \def\hdashrule@ii[#1][#2]#3#4#5{% - \let\hdr@do@something=\hdr@do@rule - \def\hdr@parse@dash##1 {% - \ifx##1!% + \@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 - \hdr@do@something[#1]{##1}{#4}% - \expandafter\hdr@parse@dash + \csname#2leaders\endcsname + \hbox{\hdr@parse@dash#5 ! }% + \hskip#3 \fi + \mbox{}% }% - \setcounter{hdr@segments}{0}% - \hdr@tally@segments#5 ! - \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 } \endinput %% -- cgit v1.2.3