[NTG-context] simple usage of \hpos

Peter Münster pmlists at free.fr
Sun Feb 7 15:26:31 CET 2010


On Sun, Feb 07 2010, Wolfgang Schuster wrote:

> Remove the 'position=yes' setup and correct the coordinates, layers use the 
> top left corner as origin but positions are measures from the left bottom 
> corner.

Ah, now I see, why the graphics was at the bottom before.

Thank you very much!

Here an example to show how I use it:

\usemodule[pre-stepwise]
\setupinteraction[state=start]
\definelayer[myBG]
\setupbackgrounds[page][background=myBG]
\def\PlaceAtPos{\dosingleempty\doPlaceAtPos}
\def\doPlaceAtPos[#1]#2#3{%
  \getparameters[PAA][dx=0pt, dy=0pt, #1]%
  \setbox\scratchbox\hbox{#3}%
  \setlayer[myBG][%
    x=\the\dimexpr\MPx{#2} - 0.5\wd\scratchbox\relax,
    y=\the\dimexpr\paperheight-\MPy{#2}-\ht\scratchbox\relax,
    dx=\PAAdx, dy=\PAAdy]{#3}}

\starttext
Place something exactly 2cm left from he\xypos{XXX}re.

Place something exactly 1 line below he\xypos{YYY}re.

Place something exactly he\xypos{ZZZ}re.

\StartSteps
\PlaceAtPos[dx=-2cm]{XXX}{\red something}           \FlushStep
\PlaceAtPos[dy=\lineheight]{YYY}{\green something}  \FlushStep
\PlaceAtPos{ZZZ}{\blue something}                   \FlushStep
\StopSteps
\stoptext

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/




More information about the ntg-context mailing list