|
397 | 397 | \newcommand{\printproblems}{\exercisesubsubsection{Problems}} |
398 | 398 | \newcommand{\printreview}{\exercisesubsubsection{Review}} |
399 | 399 |
|
400 | | -%\newlist{sectionexercises}{enumerate}{1} |
401 | | -%\setlist[sectionexercises]{label=\arabic*.,resume,leftmargin=1.5em} |
| 400 | +\newlist{sectionexercises}{enumerate}{1} |
| 401 | +\newcounter{saveexercisenum}[section] |
| 402 | +\setlist[sectionexercises]{ |
| 403 | + label=\arabic*., |
| 404 | + leftmargin=1.5em, |
| 405 | + before=\setcounter{sectionexercisesi}{\value{saveexercisenum}}, |
| 406 | + after=\setcounter{saveexercisenum}{\value{sectionexercisesi}}, |
| 407 | +} |
402 | 408 |
|
403 | 409 | \newcommand{\printexercises}[1]{% |
404 | 410 | \writeToAnsFile{#1}% writeToAnsFile in sty |
|
409 | 415 | \small% |
410 | 416 | \bigskip% |
411 | 417 | \begin{multicols}{2}% |
412 | | -% \restartlist{sectionexercises} |
413 | | -% \setcounter{sectionexercisesi}{0} |
414 | | - \restartlist{enumerate} |
415 | | - \setcounter{enumi}{0} |
416 | 418 | \renewcommand{\Itemautorefname}{Ex\-er\-cise}% local b/c multicols = good |
417 | 419 | \input{#1}% |
418 | 420 | \closeenumerate% |
|
429 | 431 | \openout\answrite=\jobname.answers |
430 | 432 |
|
431 | 433 | \newcommand{\writeToAnsFile}[1]{% |
432 | | - \immediate\write\answrite{% |
433 | | - \noexpand\answersForSection{\arabic{chapter}}{\arabic{section}}{#1}% |
| 434 | + \ifbool{latexml}{% |
| 435 | + \immediate\write\answrite{% |
| 436 | + \answersForSection{\arabic{chapter}}{\arabic{section}}{#1}% |
| 437 | + }% |
| 438 | + }{% in LaTeXML, \noexpand\answersForSection becomes a literal \relax |
| 439 | + \immediate\write\answrite{% |
| 440 | + \noexpand\answersForSection{\arabic{chapter}}{\arabic{section}}{#1}% |
| 441 | + }% |
434 | 442 | }% |
435 | 443 | } |
436 | 444 |
|
|
454 | 462 | % doesn't work? |
455 | 463 | } |
456 | 464 |
|
457 | | -\newcommand*{\enumenv}{enumerate} |
458 | | -%\newcommand*{\exerenv}{sectionexercises} |
| 465 | +\newcommand*{\exerenv}{sectionexercises} |
459 | 466 |
|
460 | 467 | \makeatletter |
461 | 468 | \newcommand{\openenumerate}{% |
462 | | -% \ifx\@currenvir\exerenv\else% |
463 | | -% \begin{sectionexercises} |
464 | | - \ifx\@currenvir\enumenv\else% |
465 | | - \begin{enumerate}[leftmargin=1.5em,resume=exercises\thesection]% |
| 469 | + \ifx\@currenvir\exerenv\else% |
| 470 | + \begin{sectionexercises} |
| 471 | + \ifbool{latexml}{\setcounter{sectionexercisesi}{\value{saveexercisenum}}}{}% |
466 | 472 | \fi% |
467 | 473 | } |
468 | 474 | \newcommand{\closeenumerate}{ |
469 | | -% \ifx\@currenvir\exerenv% |
470 | | -% \end{sectionexercises} |
471 | | - \ifx\@currenvir\enumenv% |
472 | | - \end{enumerate}% |
| 475 | + \ifx\@currenvir\exerenv% |
| 476 | + \ifbool{latexml}{\setcounter{saveexercisenum}{\value{sectionexercisesi}}}{}% |
| 477 | + \end{sectionexercises} |
473 | 478 | \fi% |
474 | 479 | } |
475 | 480 | \makeatother |
476 | 481 | \newcommand{\closeenumerateinquestions}{\closeenumerate} |
477 | 482 |
|
478 | 483 | \newenvironment{exerciseset}[2]{% |
479 | | - \stepcounter{enumi}% |
480 | | -% \stepcounter{sectionexercisesi} |
| 484 | + \stepcounter{sectionexercisesi} |
481 | 485 | \stepcounter{exercisesetcounter}% |
482 | | - \ifnumodd{\value{enumi}}{}{% |
| 486 | + \ifnumodd{\value{sectionexercisesi}}{}{% |
483 | 487 | \PackageInfo{apex}{% |
484 | | - Exercise set \theexercisesetcounter\space begins with \arabic{enumi}% |
| 488 | + Exercise set \theexercisesetcounter\space begins with \arabic{sectionexercisesi}% |
485 | 489 | }% |
486 | 490 | }% |
487 | 491 | \pagebreak[1]% |
488 | 492 | {% |
489 | 493 | \setlist[enumerate,1]{label=(\alph*)}% |
490 | | -% \noindent#1 \arabic{sectionexercisesi}--\ref*{enumiatendof\theexercisesetcounter}#2% |
491 | | - \noindent#1 \arabic{enumi}--\ref*{enumiatendof\theexercisesetcounter}#2% |
| 494 | + \noindent#1 \arabic{sectionexercisesi}--\ref*{enumiatendof\theexercisesetcounter}#2% |
492 | 495 | }% |
493 | | -% \addtocounter{sectionexercisesi}{-1}\ignorespaces% |
494 | | - \addtocounter{enumi}{-1}\ignorespaces% |
| 496 | + \addtocounter{sectionexercisesi}{-1}\ignorespaces% |
495 | 497 | \nopagebreak% |
496 | 498 | }{% |
497 | 499 | \label{enumiatendof\theexercisesetcounter}% |
498 | 500 | \closeenumerate% |
499 | 501 | \pagebreak[1]% |
500 | | - \ifnumodd{\value{enumi}}{% |
| 502 | + \ifnumodd{\value{sectionexercisesi}}{% |
501 | 503 | \PackageInfo{apex}{% |
502 | | - Exercise set \theexercisesetcounter\space ends with \arabic{enumi}% |
| 504 | + Exercise set \theexercisesetcounter\space ends with \arabic{sectionexercisesi}% |
503 | 505 | }% |
504 | 506 | }{}% |
505 | 507 | } |
|
527 | 529 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
528 | 530 |
|
529 | 531 | \newcommand{\printsolutions}[2][\jobname]{% |
530 | | - %\showans\answrite |
531 | | - % showans will write the contents of Calculus.answers to the log |
532 | | - % in latexml, this needs to happen before closing |
533 | 532 | \immediate\closeout\answrite% |
534 | 533 | \inanswersection\exercisegeometry% |
535 | 534 | \pagestyle{exercise}% |
|
0 commit comments