Re: [NTG-context] Userdata environment

2023-04-03 Thread Wolfgang Schuster via ntg-context

Fabrice Couvreur via ntg-context schrieb am 03.04.2023 um 21:42:

Hi,
I have already created a thread on the subject and Wolgang, Marco and 
Taco have replied but the userdata environment is not yet clear to me. 
I would like, if possible, to write a definition, a property or a 
theorem on the left and illustrate it in the right margin with an 
example. In the code below, the second example is on the second page 
and not next to the second definition.


You have to move the margin texts before the definition it belongs to. 
This is necessary because margin texts are flushed at the start of the 
next paragraph .


Wolfgang

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] Userdata environment

2023-04-03 Thread Fabrice Couvreur via ntg-context
Hi,
I have already created a thread on the subject and Wolgang, Marco and Taco
have replied but the userdata environment is not yet clear to me. I would
like, if possible, to write a definition, a property or a theorem on the
left and illustrate it in the right margin with an example. In the code
below, the second example is on the second page and not next to the second
definition.
Thanks.
Fabrice


\
useMPlibrary[dum]

\setuppapersize[A4]

\mainlanguage
  [fr]

\setuppagenumbering
 [alternative=doublesided]

\setuplayout
  [width=12cm,
   rightmargin=60mm]


\setupenumerations
  [before={\blank},
   after={\blank},
   alternative=serried,
   distance=0.5em,
   title=yes,
   titleleft=,
   titleright=,
   titlestyle=normal,
   headcommand=\groupedcommand{}{.},
   numbercommand=\groupedcommand{}{},
   titlecommand=\groupedcommand{(}{)},
   width=fit]

\defineenumeration
   [definition]
   [text=Définition,
number=no,
style=italic]

\defineenumeration
   [exemple]
   [text=Exemple,
number=no,
style=normal]

\definemargindata[marginfigure][inright]
\setupmargindata [marginfigure][command=\vbox,align=middle,stack=yes]

\defineuserdata [margintext] [alternative=margintext]

\defineuserdataalternative [margintext] [renderingsetup=userdata:margintext]

\startsetups [userdata:margintext]
  \margindata
[inright]
[
 style={\switchtobodyfont[10pt]},
 width=\rightmarginwidth,
 align={flushleft,broad}
]
{\startexemple
 \getinlineuserdata
 \stopexemple}
  \stopsetups

\showframe
\starttext
\startchapter[title={First Chapter},ownnumber=1]
\startdefinition
 \input ward
\stopdefinition
\startuserdata [margintext]
  \input ward
\stopuserdata
\startdefinition
  \input ward
\stopdefinition
\startuserdata [margintext]
  \input knuth
\stopuserdata
\stopchapter
\stoptext


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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___