From e72af82c3ed16b81cdb5043c58abbdbb3cf02102 Mon Sep 17 00:00:00 2001
From: Ian Jauslin <ian@jauslin.org>
Date: Mon, 4 Oct 2021 11:12:34 -0400
Subject: Initial commit

---
 doc/libs/point.sty | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 128 insertions(+)
 create mode 100644 doc/libs/point.sty

(limited to 'doc/libs/point.sty')

diff --git a/doc/libs/point.sty b/doc/libs/point.sty
new file mode 100644
index 0000000..a396d1c
--- /dev/null
+++ b/doc/libs/point.sty
@@ -0,0 +1,128 @@
+%% Copyright 2021 Ian Jauslin
+%% 
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%% 
+%%     http://www.apache.org/licenses/LICENSE-2.0
+%% 
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+
+%%
+%% 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
-- 
cgit v1.2.3-70-g09d2

