3

Using the document class book and the amsmath package, the exercise package, at first, appears to work reasonably well (MWE below). But, to the average user, it is not supported; for example, there is no example of any substance given in the package details. One cannot layout sub-examples across the page, and environments like array, equation, tabular etc. are not allowed. Adapting the headers available is beyond the average user. Is there a well-supported alternative – perhaps related to the amsmath package?

%
%--------------------------------------------------------------------------------------------------------- %
\documentclass{book}
%--------------------------------------------------------------------------------------------------------- %
%
\usepackage[fleqn]{amsmath} %
\usepackage{amsthm,amssymb} %
\usepackage[paperwidth=170mm,paperheight=240mm,textwidth=132mm,driver=none,lmargin=25mm,vmargin=20mm,showframe,showcrop]{geometry} % verbose,showcrop,showframe=inner frame
\usepackage[a4,frame,center]{crop} % pageframe
\usepackage[lastexercise,answerdelayed]{exercise}
%
\setlength{\marginparsep}{0mm} %
%
\renewcommand{\subQuestionNB}{\alph{subQuestion}) }

\renewcommand{\AnswerHeader}{\medskip{\textbf{\AnswerName\ %
    \ExerciseHeaderNB}\smallskip}}

\renewcommand{\ExerciseHeader}{\textbf{\quad\:\ExerciseName\;\ExerciseHeaderNB\ExerciseHeaderTitle\ExerciseHeaderOrigin} %
  \par\nopagebreak\medskip}

\setlength{\subQuestionIndent}{26pt}

\renewcounter{Exercise}[chapter] % Reset counter every chapter
\renewcounter{Answer}[chapter] %
\newcounter{Problem}[chapter] %
%
\def\AnswerName{\par{Answers to questions on section}} %
%
\begin{document}

\chapter{\fontsize{11}{12}\selectfont{This header would already be present within the book}}\vspace{-36pt}

\begin{Exercise}[label={chap_01_sec_01},name={Exercises on section},counter={Problem}]
  \Question{What is the symbol for iron?}
  \Question{What is the symbol for hydrogen?}
\end{Exercise}

\begin{Exercise}[label={chap_01_sec_02},name={Exercises on section},counter={Problem}]
  \Question{What is the symbol for lead?}
  \Question{For hydrogen, state the atomic number}
\end{Exercise}

\chapter{\fontsize{11}{12}\selectfont{This header would already be present within the book}}\vspace{-36pt}

\begin{Exercise}[label={chap_02_sec_01},name={Exercises on section},counter={Problem}]
  \Question{What is the symbol for copper?}
  \Question{What is the form of oxygen?}
\end{Exercise}

\begin{Exercise}[label={chap_02_sec_02},name={Exercises on section},counter={Problem}]
  \Question{What is the symbol for zinc?}
  \Question{What is the form of zinc}
\end{Exercise}
%
% There are four sets of answers that follow
% The first two sets belong to chapter 1, the second two sets to chapter 2
%
% I want a chapter 1 header to go here
%
  \begin{Answer}[ref={chap_01_sec_01}]
    \Question{Fe=iron}     
  \Question{H} 
  \end{Answer}

  \begin{Answer}[ref={chap_01_sec_02}]
  \Question{Pb=lead}
    \Question{1}
  \end{Answer}

% and a chapter 2 header to go here

  \begin{Answer}[ref={chap_02_sec_01}]
    \Question{Cu=copper}     
  \Question{oxygen is a gas} 
  \end{Answer}

  \begin{Answer}[ref={chap_02_sec_02}]
  \Question{Zn=zinc}
    \Question{zinc is a metal}
  \end{Answer}

\shipoutAnswer

\end{document}
19
  • Have you had a look at exsheets?
    – TeXnician
    Commented May 9, 2017 at 5:52
  • 3
  • @Schweinebacke Would you put it as an answer? Thx
    – jjdb
    Commented May 9, 2017 at 8:19
  • 2
    @jjdb The OP has added an example to the question. So there can still be answers showing how to use one of the alternatives for it. Please don't be so quick with close requests. Commented May 9, 2017 at 9:11
  • 2
    the question isn't very clear, you state that equation can not be used for example, but I just added an equation and an align to a question and it worked without error, similarly you say array can not be used but array is math mode and as ling as you start math mode then any math commands and environments should work. Commented May 13, 2017 at 22:54

0

Browse other questions tagged .