-
Notifications
You must be signed in to change notification settings - Fork 2
/
clauses.sty
92 lines (83 loc) · 2.27 KB
/
clauses.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{clauses}
[2016/04/08 v0.1 Typesetting sentences in clauses]
\RequirePackage{fancybox}
\RequirePackage{pdftexcmds}
\RequirePackage{alphalph}
\RequirePackage{xcolor}
\newcounter{clausenrtemp}
\def\clausenr#1#2{%
\setcounter{clausenrtemp}{#2}%
\ifnum\pdf@strcmp{#1}{0}=\z@ %
\arabic{clausenrtemp}%
\else\ifnum\pdf@strcmp{#1}{1}=\z@ %
\alphalph{\value{clausenrtemp}}%
\else\ifnum\pdf@strcmp{#1}{2}=\z@ %
\roman{clausenrtemp}%
\fi\fi\fi%
}
\newdimen\clauseskip
\clauseskip=3pt
\def\clause@itab#1{\hspace{0em}\rlap{#1}}
\def\clause@tab#1{\hspace{.06\textwidth}\rlap{#1}}
\newcount\clauselevel\clauselevel=0
\newcount\clausenra\clausenra=0
\newcount\clausenrb\clausenrb=0
\newcount\clausenrc\clausenrc=0
\long\def\clause#1{%
\advance\clauselevel by 1
\ifnum\clauselevel=1 %
\advance\clausenra by 1%
\clause@itab{\LR{\clausenr0{\the\clausenra}\clausenr11}} \clause@tab{#1}
\clausenrb=0
\else\ifnum\clauselevel=2
\advance\clausenrb by 1%
\clause@itab{\LR{\clausenr0{\the\clausenra}\clausenr1{\the\clausenrb}}} \clause@tab{#1}
\clausenrc=0
\else\ifnum\clauselevel=3
\advance\clausenrc by 1%
\clause@itab{\LR{\clausenr0{\the\clausenra}\clausenr1{\the\clausenrb}\clausenr2{\the\clausenrc}}} \clause@tab{#1}
\fi\fi\fi
\advance\clauselevel by -1
\vskip\clauseskip
}
\long\def\clauses#1{%
\advance\clauselevel by 1
\ifnum\clauselevel=1 %
\advance\clausenra by 1%
#1
\clausenrb=0
\else\ifnum\clauselevel=2 %
\advance\clausenrb by 1%
#1
\clausenrc=0
\else\ifnum\clauselevel=3 %
\advance\clausenrc by 1%
#1
\fi\fi\fi
\advance\clauselevel by -1
\par
}
\def\clausei#1#2{% Indented clause
\dimen255=\linewidth %
\advance\dimen255 by -#1em %
\advance\dimen255 by -3cm %
\clause{\clause@indent#1\begin{minipage}{\the\dimen255}%
\parindent=-1.5em
#2
\end{minipage}}%
}
\newcount\clause@indent@count
\def\clause@indent#1{%
\begingroup
\clause@indent@count=\z@
\@whilenum\clause@indent@count<#1\do{\quad\advance\clause@indent@count\@ne}%
\endgroup
}
\newcount\clausenrb@saved
\def\saveclausenrb{\clausenrb@saved=\clausenrb}
\def\restoreclausenrb{\clausenrb=\clausenrb@saved}
\def\subj#1{\textcolor{red}{#1}}
\def\pred#1{\textcolor{blue}{#1}}
\def\diacritical{$\div$~}
\def\note#1{~\textcolor{gray}{\small\LR{#1}}}