Dear Dalyoung,

I guess you are typesetting the wrong file, or you have put the last code I sent into a file which contains something of the previous codes…
Indeed in the last file I sent (which I am sending again at the end of this reply) does not contain the command \myanswer… which appears in your error message.

Please test the code below and let me know if you encunter a problem.

Best regards: OK
%%%% begin interactive-question-answer.tex
%%%% Here, following Wolfgang Schuster's ideas, 
%%%% we define some macros allowing to couple
%%%% Questions and Answers in an automatic way
%%%% Upon clicking on an interactive title for Question or Answer
%%%% one goes to the corresponding Answer or Question


% We define two counters which follow the numbers
% appearing in Question and Answer


% We create two commands to be used in the
% enumeration environments
% Note that the check for trial typestting 
% \doifnotmode{*trialtypesetting}
% is necessary in order to avoid unwanted incrementation


% We define here two enumeration environments for
% Questions and Answers


% Each question is followed immediately by its answer.
% The answers are put in a block which will be used later

% We define a command used after a  
% Question for which no Answer is provided
% Since the block commands 
% \beginanswer ... \endanswer
% cannot be used directly in a macro definition
% we use a trick...
% In the buffer the two counters associated to Answer
% are incremented...

% ...and then the above buffer is invoked

% example of use:

Prove that ${\rm e}\sim 2.73$ is irrational.
This is the first question, with its own reference, for later use.
This is the answer to the first question (to \in{Question}[q:1]).

This is the second question, without its own reference.
This is the answer to the second question. 

(Note that this answer has a reference named \type{a:Test}).

This is the third question, an easy one, without a given solution.

% we increment here the counters for Answer

This is the fourth question with its own reference.

This is the answer to the fourth question: use the result of \in{Question}[q:1].

This is the fifth question, without its own reference. 

({\it Hint:} look again at \in{Question}[q:Obvious]).
This is the answer to the fifth question. Read again \in{Answer}[a:Test].


% Here we say ownnumber=1, in order to match the prefix 
% of numbers associated to Answer
\startchapter[ownnumber=1,title=Answers and solutions]

%%%% end interactive-question-answer.tex

On 6 Nov 2016, at 23:43, Jeong Dal <> wrote:

Dear Otared,

I run the given  code and got an error message as following.

tex error       > tex error on line 1 in file virtual://block.answer.2: ! Undefined control sequence

l.1 \myanswer

<empty file>

Would you please tell me how to avoid such an error?
It seems to me that you don’t have an error.

I am running minimal(beta) in OSX.

Thank you.

Best regards,

If your question is of interest to others as well, please add an entry to the Wiki!

maillist : /
webpage  : /
archive  :
wiki     :