James Tocknell avatar James Tocknell committed 6c11e7d

Improved group theory commands

Comments (0)

Files changed (1)

texmf/tex/aragilar/group-theory-commands.sty

 
 %%%% CYCLE COMMAND — write cycles easily (from http://tex.stackexchange.com/a/54878/13520) %%%%
 %% define counters
-\newcounter{listcount}
-\newcounter{totalcount}
+\newcounter{cyclelistcount}
+\newcounter{cycletotalcount}
+%% define contants
+\newcommand{\cyclesep}{\,}
 %% define command
 \newcommand{\cycle}[1]{
-  \setcounter{totalcount}{0} % Reset total count
-  \renewcommand*{\do}[1]{\stepcounter{totalcount}}% Reconfigure count
+  \setcounter{cycletotalcount}{0} % Reset total count
+  \renewcommand*{\do}[1]{\stepcounter{cycletotalcount}}% Reconfigure count
   \docsvlist{#1}% Count number of items
-  \setcounter{listcount}{0}% Reset current item count
+  \setcounter{cyclelistcount}{0}% Reset current item count
   \renewcommand*{\do}[1]{% Reconfigure item \do
-    \stepcounter{listcount}% Next item
-    ##1\ifnum\value{listcount}<\value{totalcount}\,\fi% Print item
+    \stepcounter{cyclelistcount}% Next item
+    ##1\ifnum\value{cyclelistcount}<\value{cycletotalcount}\cyclesep\fi% Print item
   }
   \left(\docsvlist{#1}\right)% Process list
 }
+
+%%%% SET COMMAND — write sets easily %%%%
+%% define counters
+\newcounter{setlistcount} 
+\newcounter{settotalcount}
+%% define contants
+\newcommand{\setsep}{,}
+%% define command
+\newcommand{\set}[1]{
+  \setcounter{settotalcount}{0} % Reset total count
+  \renewcommand*{\do}[1]{\stepcounter{settotalcount}}% Reconfigure count
+  \docsvlist{#1}% Count number of items
+  \setcounter{setlistcount}{0}% Reset current item count
+  \renewcommand*{\do}[1]{% Reconfigure item \do
+    \stepcounter{setlistcount}% Next item
+    ##1\ifnum\value{setlistcount}<\value{settotalcount}\setsep\fi% Print item
+  }
+  \left\{\docsvlist{#1}\right\}% Process list
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.