diff options
| -rw-r--r-- | exercisesheets.sty | 43 | ||||
| -rw-r--r-- | exercisesheets.tex | 22 |
2 files changed, 51 insertions, 14 deletions
diff --git a/exercisesheets.sty b/exercisesheets.sty index 2b6316a..859e775 100644 --- a/exercisesheets.sty +++ b/exercisesheets.sty @@ -1,4 +1,4 @@ -\def\fileversion{0.5f} +\def\fileversion{0.5g} \def\filedate{2008/11/25} % TODO: allow \and in author and solutionsby @@ -354,18 +354,53 @@ \clearpage \endgroup } +\listadd{\exsh@enums}{enumerate} +\listadd{\exsh@enums}{compactenum} +\listadd{\exsh@enums}{asparaenum} +\listadd{\exsh@enums}{inparaenum} +\listadd{\exsh@nonenums}{itemize} +\listadd{\exsh@nonenums}{compactitem} +\listadd{\exsh@nonenums}{asparaitem} +\listadd{\exsh@nonenums}{inparaitem} +\listadd{\exsh@nonenums}{description} +\listadd{\exsh@nonenums}{compactdesc} +\listadd{\exsh@nonenums}{asparadesc} +\listadd{\exsh@nonenums}{inparadesc} +\listadd{\exsh@nonenums}{asparablank} +\listadd{\exsh@nonenums}{inparablank} +\listadd{\exsh@nonenums}{list} \long\def\exsh@skipsheet#1{% \ifstrequal{#1}{\begin}{\exsh@skipsheet@begin}{% \ifstrequal{#1}{\end}{\exsh@skipsheet@end}{% \ifstrequal{#1}{\label}{\exsh@skipsheet@label}{% - \exsh@skipsheet}}}% + \ifstrequal{#1}{\setcounter}{\expandafter\exsh@skipsheet\setcounter}{% + \ifstrequal{#1}{\item}{\ifdef{\@enumctr}{\@hyper@itemtrue\refstepcounter{\@enumctr}}{}}{}% + \exsh@skipsheet}}}}% } \def\exsh@skipsheet@end#1{% - \ifstrequal{#1}{sheet}{\end{sheet}}{\exsh@skipsheet}% + \ifstrequal{#1}{sheet}{\end{sheet}}{\endgroup\exsh@skipsheet}% } \def\exsh@skipsheet@begin#1{% + \begingroup \ifstrequal{#1}{exercise}{\refstepcounter{section}}{}% - \exsh@skipsheet% + \ifinlist{#1}{\exsh@enums}{% + \exsh@skipsheet@beginenum + }{% + \ifinlist{#1}{\exsh@nonenums}{% + \undef\@enumctr + }{}% + \exsh@skipsheet + }% +} +\def\exsh@skipsheet@beginenum{% + \ifnum\@enumdepth>\thr@@ + \@toodeep + \else + \advance\@enumdepth\@ne + \edef\@enumctr{enum\romannumeral\the\@enumdepth}% + \setcounter{\@enumctr}{0}% + \fi + \@ifnextchar[{\@enumlabel@{\exsh@skipsheet}[}{\exsh@skipsheet}% } \def\exsh@skipsheet@label#1{% \label{#1}\exsh@skipsheet diff --git a/exercisesheets.tex b/exercisesheets.tex index 32d4bab..66f948b 100644 --- a/exercisesheets.tex +++ b/exercisesheets.tex @@ -35,7 +35,7 @@ \title{The \exsh Package} \author{Sebastian Kuhnert} -\date{November 25th, 2008} +\date{February 9th, 2009} \begin{document} \maketitle @@ -96,13 +96,14 @@ The following options are available: \item[\option{only=\param{list of ranges}}] When given, only the mentioned sheets will be included in the output. This is useful to speed up compilation times for big documents. Some efforts are made that sheet and exercise - numbering remain consistent and references to exercises on skipped sheets - still work as expected. References to other objects are broken though (they - currently point to the exercise containing them). The \param{list of ranges} - is a comma separated list of sheet numbers and sheet ranges. If a comma is - included in the range, it has to be protected with a pair of braces. The - special sheet \enquote{number} \texttt{last} stands for the last sheet in the - document (this may require an additional \LaTeX{} run). Examples: + numbering remain consistent and references to exercises and enumerated lists + on skipped sheets still work as expected. References to other objects are + broken though (they currently point to the exercise or item containing them). + The \param{list of ranges} is a comma separated list of sheet numbers and + sheet ranges. If a comma is included in the range, it has to be protected with + a pair of braces. The special sheet \enquote{number} \texttt{last} stands for + the last sheet in the document (this may require an additional \LaTeX{} run). + Examples: \begin{description} \item[\option{only=3}] Only include the 3rd sheet of the document. \item[\option{only=\{1,3,5,7\}}] Only include the sheets 1, 3, 5 and 7. @@ -141,8 +142,9 @@ the sheet headers (see Section \ref{sec:sheet}): If one of these commands is omitted (and the corresponding option is not used either), a warning is issued. -Please do not include a \verb|\title| in your document, as \exsh will -automatically generate an appropriate one. +Please do not include a \lstinline|\title| in your document, as \exsh will +automatically generate an appropriate one (this may require an additional +\LaTeX{} run). All this information is included in the PDF meta-data if the \texttt{hyperref} package is loaded with the option \texttt{pdfusetitle}. |
