ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Resetting references or local references?
Date: Mon, 28 Nov 2011 11:24:29 +0100	[thread overview]
Message-ID: <3D6D0467-38C7-427E-9882-D97CB1362D7B@googlemail.com> (raw)
In-Reply-To: <DAC8FA69-AF64-4464-9D91-C22927F95513@gmail.com>


Am 28.11.2011 um 10:18 schrieb Otared Kavian:

> Hi Wolfgang,
> 
> Many thanks for your attention and the link you sent.
> I looked up the chapter on references of the main manuel written by Hans, but unfortunately I could not find a solution, or could not adapt what is said there. 
> It can be that I have to change my approach of defining my « exercises », for instance by defining each exercise as a section or subsection? 
> Up to now I have two ways of defining an « exercise »: 
> 	• one is with \defineenumeration[Exo] (when using mkii), 
> 	• the other one is with \defineannotation[Exo] and your annotation module when using mkiv.
> 
> In neither case the command
> 	\setupreferencing[prefix=+]
> or
> 	\setupannotation[Exo][prefix=+]
> seems to generate local tags. 
> 
> Just in case, below is a minimal file, which shows how I use the annotation module.

There are a few fixes needed in the mechanism but as you can see below it works when you know what’s wrong
but to complete the function for MkIV Hans needs a shorter example.

\setupinteraction[state=start]

\usemodule[annotation]

\define[2]\ExoSetup
  {%doifsomething{\annotationparameter{prefix}}{\setupreferencing[prefix=\annotationparameter{prefix}]}%
   \doifsomething{\annotationparameter{prefix}}{\setupreferenceprefix[\annotationparameter{prefix}]}%
   \doifsomething{\annotationparameter{prefix}}{\setupformulas[referenceprefix=\annotationparameter{prefix}]}%
   \resetnumber[formula]
   \textrule{#1}%
   \startframedtext[width=\textwidth,frame=off,leftframe=on]%
   #2%
   \stopframedtext}
	 
\defineannotation
  [Exo]
  [alternative=command,
   command=\ExoSetup,
   text=Exercise ,
   number=yes,
   headcolor=darkred]

\starttext

\startExo[prefix=CharacTwo] Prove that if $ab=ba$ and $2ab=0$ then
\placeformula[eq:1]
\startformula
(a+b)^2 = a^2 + b^2.
\stopformula
Using the identity (\in[eq:1]) prove that $(a=b)^{2n} = a^{2n} + b^{2n}$.
\stopExo

\page

\startExo[prefix=Moivre]{Moivre's formula} Prove that for any integer $n$
\placeformula[eq:1]
\startformula
(\cos(x) + {\rm i}\sin(x))^n = \cos(nx) + {\rm i} \sin(nx).
\stopformula
Using the identity (\in[eq:1]) compute $\cos{3x}$.
\stopExo

\page

\starttabulate[|Tl|l|]
\NC eq:1           \NC \in{Equation}[eq:1]                                \NC\NR
\NC CharacTwo:eq:1 \NC \in{Equation}[CharacTwo eq:1]                      \NC\NR
\NC CharacTwo:eq:1 \NC \def\referenceprefix{CharacTwo}\in{Equation}[eq:1] \NC\NR
\NC Moivre:eq:1    \NC \in{Equation}[Moivre eq:1]                         \NC\NR
\NC Moivre:eq:1    \NC \def\referenceprefix{Moivre}\in{Equation}[eq:1]    \NC\NR
\stoptabulate

\stoptext

Wolfgang

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


      reply	other threads:[~2011-11-28 10:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-27 22:27 Otared Kavian
2011-11-27 23:10 ` Wolfgang Schuster
2011-11-28  9:18   ` Otared Kavian
2011-11-28 10:24     ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D6D0467-38C7-427E-9882-D97CB1362D7B@googlemail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).