4

I am using a counter, like so:

\newcounter{sectionnumber}
\setcounter{sectionnumber}{0}
\newcounter{courseday}
\newcommand{\nextsection}{HW/Quiz \stepcounter{sectionnumber}\arabic{sectionnumber}}
\newcommand{\samesection}{Section  \arabic{sectionnumber}}

to propagate section numbers in my course calendar. However, textbook sections are numbered. 1.1, 1.2, 1.3, 2.1, 2.4, ect. Worse, I may want to cover them out of order and maybe throw an appendix in there.

How can I define a list of sections and then have a counter enumerate this list in order?

Spewin
  • 43

2 Answers2

3

It is not entirely clear what you're after here. However, the following might push you in the right direction:

enter image description here

\documentclass{article}
\usepackage{arrayjobx}% http://ctan.org/pkg/arrayjobx
\newarray\sectionnumlist\newcounter{sectionnumlist}
\readarray{sectionnumlist}{1.1&1.2&1.3&1.4&2.1&2.4&1.5&2.2&2.3}
\newcommand{\nextsection}{%
  \stepcounter{sectionnumlist}%
  {\bfseries HW/Quiz \sectionnumlist(\thesectionnumlist)}\quad}
\newcommand{\samesection}{%
  {\bfseries Section \sectionnumlist(\thesectionnumlist)}\quad}
\begin{document}
\nextsection Some stuff

\nextsection Some more stuff

\samesection Some stuff

\nextsection Even more stuff

\nextsection Some stuff

\nextsection Some more stuff

\samesection Some stuff

\nextsection Even more stuff

\nextsection Some stuff

\nextsection Some more stuff

\samesection Some stuff

\nextsection Even more stuff
\end{document}

You define the sequence of the section numbers using \readarray{sectionnumlist}{<num>&<num>&<num>&...}, which is then used to cycle through whenever you use \nextsection.

Werner
  • 603,163
0

It looks like the forarray package will work, which I found through this answer:

https://tex.stackexchange.com/a/73906/37294

Here's my current implementation: though it's not as good as the answer above.

\newcounter{sectionnumber}
\setcounter{sectionnumber}{0}
\newcounter{courseday}
\newcommand{\nextsection}{%
\stepcounter{sectionnumber}%
\ForEach{,}{%
\ifthenelse{\arabic{sectionnumber}=\the\thislevelcount}{\thislevelitem\ExitForEach}{}%
}%
{3.1,3.2,3.3,4.1,4.2,4.3,4.4,4.5,4.6,App. D, 5.1, 5.2, 5.3, 6.1, 6.2, 6.3, 7.1, 7.2, 7.3, 7.4, 8.1, 8.2, 8.3, 8.4, 9.1, 10.1, 10.2, 10.3, 10.4, 10.5, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 12.1, 12.2, 12.3, 15, 13, 9.2, 9.3}%
}%
Spewin
  • 43