-
Notifications
You must be signed in to change notification settings - Fork 0
/
selective.sty
63 lines (60 loc) · 1.83 KB
/
selective.sty
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
%%
%% This is file `selective.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% selective.dtx (with options: `package')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from selective.sty.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file selective.dtx.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% © 2013 Sebastián González
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{eclectex/selective}
[2013/07/11 v0.0 Utilities to selectively typeset text]
\RequirePackage{eclectex/lists}
\RequirePackage{environ}
\RequirePackage{pgffor}
\def\selective@tags{}
\newif\if@body@tags@found
\newif\if@selective@tag@found
\NewEnviron{selective}[1]
{\def\tagConjunctions{#1}%
\@body@tags@foundtrue%
\foreach \tagDisjuction in \tagConjunctions
{\@selective@tag@foundfalse%
\foreach \activeTag in \selective@tags
{\foreach \bodyTag in \tagDisjuction
{\ifdefstrequal{\activeTag}{\bodyTag}
{\global\@selective@tag@foundtrue\breakforeach}{}}}%
\if@selective@tag@found\else%
\global\@body@tags@foundfalse\breakforeach%
\fi}%
\if@body@tags@found%
\BODY%
\fi}
\newcommand{\selectiveTag}[1]
{\listInclude{\selective@tags}{#1}%
\edef\implied@tags{\csuse{#1@tag@implications}}%
%\ifcsvoid{#1@tag@implications}{}
\foreach \implied@tag in \implied@tags
{\selectiveTag{\implied@tag}}}
\newcommand{\selectiveTagImplies}[2]
{\csdef{#1@tag@implications}{#2}}
\endinput
%%
%% End of file `selective.sty'.