fb6e197aea22a9a18c0f914fa15f45e404173d87
[ppam-mpi.git] / communication / slides / dashundergaps.sty
1 %% This is file `dashundergaps.sty' v1.2 by Merciadri Luca.
2
3 \NeedsTeXFormat{LaTeX2e}
4 \ProvidesPackage{dashundergaps}[2010/01/20 Dashing and underlining (phantom) text]
5 \PackageInfo{dashundergaps}{This is DashUnderGaps by Merciadri Luca.}
6
7 \RequirePackage{ifthen}[1994/06/01]
8 \PassOptionsToPackage{normalem}{ulem}
9 \RequirePackage{ulem}
10 \newboolean{dot} % false at start
11 \newboolean{dash} % false at start
12
13
14 \DeclareOption{dash}{%
15 \typeout{Dashing mode activated!}
16 \setboolean{dash}{true}
17 \providecommand{\dashuline}{\bgroup
18 \ifdim\ULdepth=\maxdimen
19 \settodepth\ULdepth{(j}\advance\ULdepth.4pt\fi
20 \markoverwith{\kern.15em
21 \vtop{\kern\ULdepth \hrule width .3em}%
22 \kern.15em}\ULon}
23 }
24
25
26 \DeclareOption{dot}{%
27 \typeout{Dotting mode activated!}
28 \setboolean{dot}{true}
29 \providecommand{\dotuline}{\bgroup
30 \ifdim\ULdepth=\maxdimen
31 \settodepth\ULdepth{(j}\advance\ULdepth.4pt\fi
32 \markoverwith{\begingroup
33 \advance\ULdepth0.08ex
34 \lower\ULdepth\hbox{\kern.15em .\kern.1em}%
35 \endgroup}\ULon}
36 }
37
38
39 \DeclareOption{phantomtext}{%
40 \typeout{Phantom mode activated! All the gaps will be filled.}
41 \newboolean{teachernotes} % false at start
42 \newcounter{nb-gaps}
43 \setcounter{nb-gaps}{1}
44 \newcounter{nth-gaps}
45 \setcounter{nth-gaps}{1}
46
47 \def\phantom@putbox{\ifx\UL@start\@empty \else % not inner
48 \vrule\@width\z@ \LA@penalty\@M
49 {\UL@skip\wd\UL@box \UL@leaders \kern-\UL@skip}%
50 \hbox to\wd\UL@box{}\fi}%
51
52 \providecommand{\gap}[1]{%
53 \bgroup
54 \let\UL@putbox=\phantom@putbox
55 \ifthenelse{\boolean{teachernotes}}
56 {\textbf{#1} (\arabic{nth-gaps})}
57 {\ifthenelse{\boolean{dash} \AND \boolean{dot}}{\uline{#1}(\arabic{nth-gaps})}{\ifthenelse{\boolean{dash}}{\dashuline{#1} (\arabic{nth-gaps})}{\ifthenelse{\boolean{dot}}{\dotuline{#1} (\arabic{nth-gaps})}{\uline{#1} (\arabic{nth-gaps})}}}
58 }
59 \addtocounter{nb-gaps}{1}
60 \addtocounter{nth-gaps}{1}
61 \egroup
62 }}
63
64
65 \DeclareOption{teachernotes}{%
66 \typeout{Phantom mode deactivated! All the gaps will be filled with their content.}
67 \setboolean{teachernotes}{true}
68 }
69
70
71 \DeclareOption{displaynbgaps}{%
72 \typeout{Gaps counting mode activated!}
73 \addtocounter{nb-gaps}{-1}
74 \AtEndDocument{\vfill \centering \bfseries GAPS: \arabic{nb-gaps}.}
75 }
76
77 \ProcessOptions\relax
78