On Thu, 5 Jun 2008, Joachim Kreimer-de Fries wrote:


In friendly and helpfully answering to my late night question

How to create _numbered_ margin notes in ConTeXt?

Hans Hagen wrote 05.06.2008 at 10:04:
quick and dirty command (instead one can use enumerations and do some
complex setup)

Before ending this day, I want to thank you for your endeavour (also
for Taco's attentive regret).

Dear Hans, you know what your code produces:

- indeed, the marginal notes are numbered (I can live with the fact
that this is not the kind numbering of notes (cf. footnotes) one -
the reader - expects);

- indeed the notes are no longer printed one over the other.

BUT:

- the accent sign ( ยด ) placed in the text body before the next word
following that wich is explained in the marginal note will not be
accepted and understood by the readers. It must, of course, be a
superscripts number (the same number as in the referencing marginal
note).

A slight bug in Hans's code. See below.

AND:

You won't really expect that someone outside the circle of you
programmers who have developed ConTeXt, i. e. a simple (beginning)
user of ConTeXt - even if highly willing to learn, is able to change
this code in a way to get the wanted results (which I had illustrated
with the pdf-file produced under extremly frustrating formating
effort with OpenOffice Writer).


With two exceptions (\def and \setupinmargin) I did not find any of
the used commands documented in "ConTEXt - the manual" or the
"commands" quick reference of 2001. I could not verify in the http://
texshow.contextgarden.net/
because not available - as almost everytime. But from my last
remember, when it - for once - was available, they are not in there,
neither.

The user manual is for already existing features. In order to understand how to *extend* context, you need to know how the internals work. See
http://wiki.contextgarden.net/Inside_ConTeXt


Let me try to explain the code (slightly adapted). First the adapted code:

\newcounter\MyMarginalNote

\def\mnote{\dosingleempty\domnote}

\def\domnote[#1]#2%
  {\doglobal\increment\MyMarginalNote
   \high{\MyMarginalNote}%
   \inmargin
      {\MyMarginalNote:
       \doifsomething{#1}
        {\expanded{\textreference[#1]{\MyMarginalNote}}}#2}}



Now the explaination:

\newcounter\MyMarginalNote

Defines a new counter called MyMarginalNode. Hans did not use this because he knows how \increment works internally, but explicitly stating this helps in understanding.

\def\mnote{\dosingleempty\domnote}

This is the standard method in context of dealing with optimal arguments. See http://wiki.contextgarden.net/Commands_with_optional_arguments

\def\domnote[#1]#2%

#1 is the optional argument (in square brackets), and #2 is the required arugment (in curly brackets)

  {\doglobal\increment\MyMarginalNote

Increment the counter MyMaginalNote. The \doglobal is there so that the counter is incremented even when the mnote occurs inside a group, for example, something like

\startframedtext
  blah blah\mnote{abc}
\stopfamedtext

   \high{\MyMarginalNote}%

Place the number as a superscript.

   \inmargin

Place the contents in the margin

      {\MyMarginalNote:

Place margin note number followed by colon

       \doifsomething{#1}
        {\expanded{\textreference[#1]{\MyMarginalNote}}}

if #1 is something (that is, #1 is not empty) create a textreference #1 with the text \MyMarginNote. The expanded is there so that the reference is to the value of MyMarginNote when the margin note was created and not want the value of text reference was asked.

       #2}}

Place #2, that is the contents of the note.


On the one hand I have still the impression, that ConTeXt is a highly
adaptable and flexible typesetting system within TeX (probably my
intents with marginal notes as help for understanding texts could
find a solution),

on the other hand I'm almost giving up with my intention, because the
only program/system with wich I a had hope to resolve this problem is
not configurable for me, because ... I'm not a programmer or software
developer, because you ConTeXt-developers don't care enough about
usable, applicable documentation, because the cultural, didactical
value of the old (hand-)  typesetting technique of marginal notes has
come out of fashion, what ever...

This is not configurable because it was more like a proof of concept solution. There is no documentation because of the same reason.

N. B. I recommend the provision in ConTeXt for marginal notes in my
intented sense warmly to you: they are an acquirement of civilization
with big possibilities for the future and no other - at least no word
processing program - is able to handle them yet in a acceptable manner!

Hans, would it be too difficult to incorporate marginal notes in the core, so that one could define \definenote[mnote][location=margin]. Most of the pieces are already there.

Nevertheless, be it pure curiousness or still persistant hope in
acquiring the skills for ConTeXt, I would like to know:

1.
in your sample code, Hans:
between \starttext and \stoptext you write once (the first time of
occurrence):
bla bla bla \mnote{xxx} bla bla

but in the second time:
bla bla bla \mnote[foo]{xxx} bla bla bla

and then again:

bla bla bla \mnote{xxx}

Has the [foo] after the first \mnote any relevance and which?

This is the standard approach in ConTeXt of providing a means to reference the notes later if you want. As you observed

2.
the last row of your "document" text is:

in \in {note} [foo]

in my pdf-output this appears as :

"in note 2"

This is not reasonable and desired (it should not appear). Was it a
"slip of the pen" on your side or any purpose, if yes, which one?

one can use \in {note} [foo] to recall the number of the note. In case you do not need it, simply do not type it.
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to