Ian Jauslin
summaryrefslogtreecommitdiff
blob: 4a761b75870edd6a405c7b0799027e1313fd5d68 (plain)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
%%
%% Points package:
%%   \point commands
%%

%% TeX format
\NeedsTeXFormat{LaTeX2e}[1995/12/01]

%% package name
\ProvidesPackage{point}[2017/06/13]

%% options
\newif\ifresetatsection
\DeclareOption{reset_at_section}{\resetatsectiontrue}
\DeclareOption{no_reset_at_section}{\resetatsectionfalse}
\newif\ifresetatsubsection
\DeclareOption{reset_at_subsection}{\resetatsubsectiontrue}
\DeclareOption{no_reset_at_subsection}{\resetatsubsectionfalse}
\newif\ifresetatsubsubsection
\DeclareOption{reset_at_subsubsection}{\resetatsubsubsectiontrue}
\DeclareOption{no_reset_at_subsubsection}{\resetatsubsubsectionfalse}
\newif\ifresetattheo
\DeclareOption{reset_at_theo}{\resetattheotrue}
\DeclareOption{no_reset_at_theo}{\resetattheofalse}

\def\point@defaultoptions{
  \ExecuteOptions{reset_at_section, reset_at_subsection, reset_at_subsubsection, no_reset_at_theo}
  \ProcessOptions

  %% reset at every new section
  \ifresetatsection
    \let\point@oldsection\section
    \gdef\section{\resetpointcounter\point@oldsection}
  \fi
  %% reset at every new subsection
  \ifresetatsubsection
    \let\point@oldsubsection\subsection
    \gdef\subsection{\resetpointcounter\point@oldsubsection}
  \fi
  %% reset at every new subsubsection
  \ifresetatsubsubsection
    \let\point@oldsubsubsection\subsubsection
    \gdef\subsubsection{\resetpointcounter\point@oldsubsubsection}
  \fi

  %% reset at every new theorem
  \ifresetattheo
    \ifdefined\iantheotrue
      \let\point@oldtheo\theo
      \gdef\theo{\resetpointcounter\point@oldtheo}
    \fi
  \fi
}


%% point
% counter
\newcounter{pointcount}
\def\point{
  \stepcounter{pointcount}
  \setcounter{subpointcount}{0}
  % hyperref anchor (only if the class is 'ian')
  \ifdefined\ifianclass
    \hrefanchor
    % define tag (for \label)
    \xdef\tag{\thepointcount}
  \fi
  % header
  \indent{\bf \thepointcount\ - }
}

%% subpoint
% counter
\newcounter{subpointcount}
\def\subpoint{
  \stepcounter{subpointcount}
  \setcounter{subsubpointcount}0
  % hyperref anchor (only if the class is 'ian')
  \ifdefined\ifianclass
    \hrefanchor
    % define tag (for \label)
    \xdef\tag{\thepointcount-\thesubpointcount}
  \fi
  % header
  \indent\hskip.5cm{\bf \thepointcount-\thesubpointcount\ - }
}

%% subsubpoint
% counter
\newcounter{subsubpointcount}
\def\subsubpoint{
  \stepcounter{subsubpointcount}
  % hyperref anchor (only if the class is 'ian')
  \ifdefined\ifianclass
    \hrefanchor
    % define tag (for \label)
    \xdef\tag{\thepointcount-\thesubpointcount-\thesubsubpointcount}
  \fi
  \indent\hskip1cm{\bf \thepointcount-\thesubpointcount-\thesubsubpointcount\ - }
}


%% reset point counters
\def\resetpointcounter{
  \setcounter{pointcount}{0}
  \setcounter{subpointcount}{0}
  \setcounter{subsubpointcount}{0}
}



%% end
\point@defaultoptions
\endinput