From 371ccb95f6e45efc2b42d558fba7d4e4fc9d1ae3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 19 Nov 2018 21:55:47 +0000 Subject: dashundergaps (19nov18) git-svn-id: svn://tug.org/texlive/trunk@49198 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/dashundergaps/dashundergaps.sty | 118 ++++++++++++++------- 1 file changed, 78 insertions(+), 40 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/dashundergaps/dashundergaps.sty b/Master/texmf-dist/tex/latex/dashundergaps/dashundergaps.sty index 17db0222797..45193e4be4e 100644 --- a/Master/texmf-dist/tex/latex/dashundergaps/dashundergaps.sty +++ b/Master/texmf-dist/tex/latex/dashundergaps/dashundergaps.sty @@ -22,7 +22,7 @@ %% version 2005/12/01 or later. %% %% This file may only be distributed together with a copy of the LaTeX -%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +%% `dashundergaps Bundle'. You may however distribute the `dashundergaps Bundle' %% without such generated files. %% %% The newest sources can be found below @@ -33,6 +33,10 @@ %% %% %% File: dashundergaps.dtx (C) Copyright 2018 Frank Mittelbach + +\def\dashundergapsdate {2018/11/18} +\def\dashundergapsversion{v2.0d} + \RequirePackage[normalem]{ulem} \def\dotuline{\bgroup \UL@setULdepth @@ -41,21 +45,29 @@ \lower\ULdepth\hbox{\normalfont \kern.1em .\kern.04em}% \endgroup}% \ULon} - -\def\@ublank{\bgroup\let\UL@leadtype\@empty\ULon} - -\def\phantom@putbox{\ifx\UL@start\@empty \else % not inner +\MakeRobust\dotuline +\def\uwave{\bgroup + \UL@setULdepth + \advance\ULdepth 0.6\p@ + \markoverwith{\lower\ULdepth\hbox{\sixly \char58}}\ULon} +\MakeRobust\uwave +\def\fmdug@ublank{\bgroup\let\UL@leadtype\@empty\ULon} +\def\UL@dischyp{\global\setbox\UL@hyphenbox\hbox + {\ifnum \hyphenchar\font<\z@ \string-\else \char\hyphenchar\font \fi}% + \kern\wd\UL@hyphenbox \LA@penalty\@M + \UL@stop \kern-\wd\UL@hyphenbox + \discretionary{\fmdug@box\UL@hyphenbox}{}{}\UL@start} +\def\UL@putbox{\ifx\UL@start\@empty \else % not inner \vrule\@width\z@ \LA@penalty\@M {\UL@skip\wd\UL@box \UL@leaders \kern-\UL@skip}% - \hb@xt@\wd\UL@box{}% -\fi} + \fmdug@box\UL@box \fi} +\let\fmdug@box\box \RequirePackage{xparse,l3keys2e} -\ProvidesExplPackage - {dashundergaps} - {2018/06/24} - {v2.0a} - {Dashing and underlining (phantom) text} +\ProvidesExplPackage{dashundergaps} + {\dashundergapsdate} + {\dashundergapsversion} + {Dashing and underlining phantom text} \DeclareDocumentCommand \gap { som } { \__fmdug_gap:nnn {#1}{#2}{#3} } \NewDocumentCommand \dashundergapssetup { m } @@ -63,26 +75,29 @@ \DeclareDocumentCommand \TeacherModeOn {} { \bool_set_true:N \l__fmdug_teacher_bool } \DeclareDocumentCommand \TeacherModeOff {} - { \bool_set_true:N \l__fmdug_teacher_bool } + { \bool_set_false:N \l__fmdug_teacher_bool } \newcounter{gapnumber} \newcounter{totalgapnumber} \dim_new:N \l__fmdug_extend_dim - \tl_new:N \l__fmdug_extra_left_gap_tl \tl_new:N \l__fmdug_extra_right_gap_tl +\tl_new:N \l__fmdug_gap_format_tl +\tl_new:N \l__fmdug_teacher_gap_format_tl \msg_new:nnn {dashundergaps} {deprecated} - { - The~ #1~ `#2'~ you~ used~ \msg_line_context: \ is~ deprecated~and~ there~ - is~ no~ replacement.~ Since~ I~ will~ not~ guarantee~ that~ #1~ `#2'~ - will~ be~ kept~ forever~ I~ strongly~ encourage~ you~ to~ remove~ it~ - from~ your~ document. - } + { The~ #1~ `#2'~ you~ used~ \msg_line_context: \ is~ deprecated~ and~ + there~ is~ no~ replacement.~ Since~ I~ will~ not~ guarantee~ that~ + #1~ `#2'~ will~ be~ kept~ forever~ I~ strongly~ encourage~ you~ + to~ remove~ it~ from~ your~ document. } \msg_new:nnnn {dashundergaps} {nested} - { The~ \gap command~ can't~ be~ tested! } - { Nesting~ doesn't~ make~ much~ sense~ as~ the~ inner~ one~ wouldn't~ be~ - visible.~ ~ To~ allow~ continuation~ it~ is~ handled~ as~ if~ it~ wasn't~ - been~ asked~ for. } + { The~ \gap command~ can't~ be~ nested! } + { Nesting~ doesn't~ make~ much~ sense~ as~ the~ inner~ one~ + wouldn't~ be~ visible.~ ~ To~ allow~ further~ processing~ it~ is~ + handled~ as~ if~ it~ hasn't~ been~ asked~ for. } +\msg_new:nnnn {dashundergaps} {gap-format-value} + { Unknown~ value~ for~ key~ '#1 gap-format'! } + { Supported~ values~ are~ 'underline',~ 'double-underline',\\ + 'dash',~ 'dot',~ 'wave'~ or~ 'blank'. } \keys_define:nn {fmdug} { % ==================================== @@ -95,24 +110,46 @@ ,gap-format .choice: ,gap-format / underline - .code:n = \tl_set:Nn \l__fmdug_gap_format_tl { \uline } + .code:n = \tl_set:Nn \l__fmdug_gap_format_tl + { \__fmdug_gap_format_adjust:n{.4pt} \uline } + ,gap-format / double-underline + .code:n = \tl_set:Nn \l__fmdug_gap_format_tl + { \__fmdug_gap_format_adjust:n{2pt} \uuline } ,gap-format / dash - .code:n = \tl_set:Nn \l__fmdug_gap_format_tl { \dashuline } + .code:n = \tl_set:Nn \l__fmdug_gap_format_tl + { \__fmdug_gap_format_adjust:n{0pt} \dashuline } ,gap-format / dot - .code:n = \tl_set:Nn \l__fmdug_gap_format_tl { \dotuline } + .code:n = \tl_set:Nn \l__fmdug_gap_format_tl + { \__fmdug_gap_format_adjust:n{-.08ex} \dotuline } ,gap-format / wave - .code:n = \tl_set:Nn \l__fmdug_gap_format_tl { \uwave } + .code:n = \tl_set:Nn \l__fmdug_gap_format_tl + { \__fmdug_gap_format_adjust:n{1pt} \uwave } ,gap-format / blank - .code:n = \tl_set:Nn \l__fmdug_gap_format_tl { \@ublank } + .code:n = \tl_set:Nn \l__fmdug_gap_format_tl { \fmdug@ublank } ,gap-format / unknown - .code:n = \tl_set:Nn \l__fmdug_gap_format_tl { #1 } + .code:n = \msg_error:nnn{dashundergaps}{gap-format-value}{} ,gap-format .initial:n = underline % ==================================== + ,gap-format-adjust + .choice: + ,gap-format-adjust / true + .code:n = \cs_set:Npn \__fmdug_gap_format_adjust:n ##1 + { \setlength\ULdepth {##1} } + ,gap-format-adjust / false + .code:n = \cs_set_eq:NN \__fmdug_gap_format_adjust:n \use_none:n + ,gap-format-adjust + .default:n = true + ,gap-format-adjust + .initial:n = true + ,adjust .meta:n = { gap-format-adjust } + % ==================================== ,teacher-gap-format .choice: ,teacher-gap-format / underline .code:n = \tl_set:Nn \l__fmdug_teacher_gap_format_tl { \uline } + ,teacher-gap-format / double-underline + .code:n = \tl_set:Nn \l__fmdug_teacher_gap_format_tl { \uuline } ,teacher-gap-format / dash .code:n = \tl_set:Nn \l__fmdug_teacher_gap_format_tl { \dashuline } ,teacher-gap-format / dot @@ -120,9 +157,9 @@ ,teacher-gap-format / wave .code:n = \tl_set:Nn \l__fmdug_teacher_gap_format_tl { \uwave } ,teacher-gap-format / blank - .code:n = \tl_set:Nn \l__fmdug_teacher_gap_format_tl { \@ublank } + .code:n = \tl_set:Nn \l__fmdug_teacher_gap_format_tl { \fmdug@ublank } ,teacher-gap-format / unknown - .code:n = \tl_set:Nn \l__fmdug_teacher_gap_format_tl { #1 } + .code:n = \msg_error:nnn{dashundergaps}{gap-format-value}{teacher-} ,teacher-gap-format .initial:n = blank % ==================================== @@ -133,7 +170,7 @@ ,widen .meta:n = { gap-widen } % ------------------ ,gap-extend-minimum .dim_set:N = \l__fmdug_gap_min_dim - ,gap-extend-minimum .initial:n = 10pt + ,gap-extend-minimum .initial:n = 20pt % ------------------ ,gap-extend-percent .tl_set:N = \l__fmdug_gap_percent_tl ,gap-extend-percent .initial:n = 20 @@ -176,7 +213,6 @@ \stepcounter{totalgapnumber} \bool_xor:nnT { #1 } { \l__fmdug_number_bool } { \refstepcounter{gapnumber} } - \bool_if:NTF \l__fmdug_gap_widen_bool { \settowidth \l__fmdug_extend_dim {#3} @@ -195,14 +231,16 @@ } \bool_if:NTF \l__fmdug_teacher_bool { \l__fmdug_teacher_gap_format_tl } - { \cs_set_eq:NN \UL@putbox \phantom@putbox + { + \cs_set:Npn \fmdug@box ##1 {\hbox_to_wd:nn{\box_wd:N ##1}{}} \str_case:nnF {#2} { - {u} { \uline } - {w} { \uwave } - {b} { \@ublank } - {.} { \dotuline } - {-} { \dashuline } + {u} { \__fmdug_gap_format_adjust:n{.4pt} \uline } + {d} { \__fmdug_gap_format_adjust:n{2pt} \uuline } + {w} { \__fmdug_gap_format_adjust:n{1pt} \uwave } + {b} { \fmdug@ublank } + {.} { \__fmdug_gap_format_adjust:n{-.08ex} \dotuline } + {-} { \__fmdug_gap_format_adjust:n{0pt} \dashuline } } { \l__fmdug_gap_format_tl } } -- cgit v1.2.3