# [NTG-context] anchor points for \inmargin

Wolfgang Schuster schuster.wolfgang at gmail.com
Thu Nov 12 19:14:27 CET 2015

```> DesdeChaves <mailto:desdechaves at gmail.com>
> 11. November 2015 um 19:01
> Dear Sirs,
>
> I'm trying to make a exam for my students. After the question I should
> provide a blank space for the answer. In the margin I want write the
> partial scores for the answer. The problem  occurs when I force a new
> page. In this case the text in the margin is flushed to the next page.
> I don't want this behavior. How can I can  this?
Margin texts are flushed with the next paragraph but you can start one
for the points only with the \dontleavehmode command.

\define[1]\Info
{\dontleavehmode\margindata[inmargin]{\rotate{#1}}}

> Another question: How can I anchor the scores in the middle of the
> vertical blank space?  This  \vskip4cm\Info{scores}\vskip4cm don't
> make the job.
You can use the \framed command to reserve the space for the answer and
place with the score with a layer as background for the frame.

\setupmargindata[inmargin][style={\ss\tfx},location=outer,align=middle]
\setupmarginframed[inmargin][align=middle,location=outer]

\definelayer[infolayer][width=\framedwidth,height=\framedheight]

\startsetups[infolayer:place]

\setlayer[infolayer][preset=middleright]{\rotate{\getvariable{infotext}{points}}}
\stopsetups

\defineframed[infobox][frame=off,width=max,background=infolayer,setups=infolayer:place]

\define[2]\Info
{\par
\setvariable{infotext}{points}{#2}%
\infobox[height=#1]{}}

\starttext

\startitemize[n]
\Info{9cm}{20 \periods[3] 15 \periods[3] 10}
\Info{8cm}{20 \periods[3] 15 \periods[3] 10}
\Info{6cm}{20 \periods[3] 15 \periods[3] 10}