diff options
Diffstat (limited to 'point.sty')
-rw-r--r-- | point.sty | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/point.sty b/point.sty new file mode 100644 index 0000000..da06361 --- /dev/null +++ b/point.sty @@ -0,0 +1,107 @@ +%% +%% 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\ifresetattheo +\DeclareOption{reset_at_theo}{\resetattheotrue} +\DeclareOption{no_reset_at_theo}{\resetattheofalse} + +\def\point@defaultoptions{ + \ExecuteOptions{reset_at_section, reset_at_subsection, 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 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{\arabic{pointcount}} + \fi + % header + \indent{\bf \arabic{pointcount}\ - } +} + +%% 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{\arabic{pointcount}-\arabic{subpointcount}} + \fi + % header + \indent\hskip.5cm{\bf \arabic{pointcount}-\arabic{subpointcount}\ - } +} + +%% 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{\arabic{pointcount}-\arabic{subpointcount}-\arabic{subsubpointcount}} + \fi + \indent\hskip1cm{\bf +\arabic{pointcount}-\arabic{subpointcount}-\arabic{subsubpointcount}\ - } +} + + +%% reset point counters +\def\resetpointcounter{ + \setcounter{pointcount}{0} + \setcounter{subpointcount}{0} + \setcounter{subsubpointcount}{0} +} + + + +%% end +\point@defaultoptions +\endinput |