* simple usage of \hpos
@ 2010-02-06 22:17 Peter Münster
2010-02-07 8:42 ` Wolfgang Schuster
0 siblings, 1 reply; 7+ messages in thread
From: Peter Münster @ 2010-02-06 22:17 UTC (permalink / raw)
To: ConTeXt list
Hello,
How can I place an element as background at a previously defined position?
Here a test-file to show what I'm looking for:
\definelayer[graphics][position=yes]
\setupbackgrounds[page][background=graphics]
\starttext
Here is some text. I would like to appear a graphics exactly
behind \hpos{XXX}{HERE}. How can I do this, without measuring by hand the
x- and y-offsets, and perhaps also without using metapost?
Such a command would be fine: \type{\placeatpos[XXX]{my background
figure}}, or \type{\setlayer[graphics][location=XXX]{...}}.
\setlayer[graphics][dx=128mm, dy=-27mm]{\externalfigure[hacker.jpg][width=1cm]}
\stoptext
TIA for any help!
Cheers, Peter
--
Contact information: http://pmrb.free.fr/contact/
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: simple usage of \hpos
2010-02-06 22:17 simple usage of \hpos Peter Münster
@ 2010-02-07 8:42 ` Wolfgang Schuster
2010-02-07 12:22 ` Peter Münster
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2010-02-07 8:42 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 06.02.10 23:17, schrieb Peter Münster:
> Hello,
>
> How can I place an element as background at a previously defined position?
>
> Here a test-file to show what I'm looking for:
>
> \definelayer[graphics][position=yes]
> \setupbackgrounds[page][background=graphics]
> \starttext
> Here is some text. I would like to appear a graphics exactly
> behind \hpos{XXX}{HERE}. How can I do this, without measuring by hand the
> x- and y-offsets, and perhaps also without using metapost?
untested:
\newcounter\BackgroundPictures
\definelayer[BackgroundPicture][width=\paperwidth,height=\paperheight]
\def\FixedPicture
{\dodoubleempty\doFixedPicture}
\def\doFixedPicture[#1][#2]%
{\doglobal\increment\BackgroundPictures
\xypos{fixedpicture:\BackgroundPictures}%
\doifnotmode{first}
{\setlayer
[BackgroundPicture]
[x=\MPx{fixedpicture:\BackgroundPictures},
y=\MPy{fixedpicture:\BackgroundPictures}]
{\externalfigure[#1][#2]}}}
\setupbackgrounds[page][background=BackgroundPicture]
\starttext
... \FixedPicture[...] ...
\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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: simple usage of \hpos
2010-02-07 8:42 ` Wolfgang Schuster
@ 2010-02-07 12:22 ` Peter Münster
2010-02-07 12:46 ` Wolfgang Schuster
0 siblings, 1 reply; 7+ messages in thread
From: Peter Münster @ 2010-02-07 12:22 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, Feb 07 2010, Wolfgang Schuster wrote:
> \newcounter\BackgroundPictures
>
> \definelayer[BackgroundPicture][width=\paperwidth,height=\paperheight]
>
> \def\FixedPicture
> {\dodoubleempty\doFixedPicture}
>
> \def\doFixedPicture[#1][#2]%
> {\doglobal\increment\BackgroundPictures
> \xypos{fixedpicture:\BackgroundPictures}%
> \doifnotmode{first}
> {\setlayer
> [BackgroundPicture]
> [x=\MPx{fixedpicture:\BackgroundPictures},
> y=\MPy{fixedpicture:\BackgroundPictures}]
> {\externalfigure[#1][#2]}}}
>
> \setupbackgrounds[page][background=BackgroundPicture]
>
> \starttext
>
> ... \FixedPicture[...] ...
>
> \stoptext
Hello Wolfgang,
No, it does not work. The main idea, to position the layer with
x=\MPx{} and y=\MPy{} seems to be broken.
Smaller test-file:
\definelayer[graphics][position=yes]
\setupbackgrounds[page][background=graphics]
\starttext
I would like to appear a graphics exactly 2cm left from he\xypos{XXX}re.
\setlayer[graphics][x=\MPx{XXX}, y=\MPy{XXX}, dx=-2cm]{%
\externalfigure[hacker.jpg][width=1cm]}
\stoptext
Any other ideas?
Thanks, Peter
--
Contact information: http://pmrb.free.fr/contact/
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: simple usage of \hpos
2010-02-07 12:22 ` Peter Münster
@ 2010-02-07 12:46 ` Wolfgang Schuster
2010-02-07 14:26 ` Peter Münster
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2010-02-07 12:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 07.02.10 13:22, schrieb Peter Münster:
> The main idea, to position the layer with x=\MPx{} and y=\MPy{} seems to be broken.
>
> Smaller test-file:
>
> \definelayer[graphics][position=yes]
> \setupbackgrounds[page][background=graphics]
> \starttext
> I would like to appear a graphics exactly 2cm left from he\xypos{XXX}re.
>
> \setlayer[graphics][x=\MPx{XXX}, y=\MPy{XXX}, dx=-2cm]{%
> \externalfigure[hacker.jpg][width=1cm]}
> \stoptext
>
> Any other ideas?
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.
\definelayer[graphics]
\setupbackgrounds[page][background=graphics]
\starttext
I would like to appear a graphics exactly 2cm left from he\xypos{XXX}re.
\setlayer
[graphics]
[x=\the\dimexpr\MPx{XXX}-2cm\relax,
y=\the\dimexpr\paperheight-\MPy{XXX}-\strutht\relax]
{\externalfigure[hacker.jpg][width=1cm]}
\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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: simple usage of \hpos
2010-02-07 12:46 ` Wolfgang Schuster
@ 2010-02-07 14:26 ` Peter Münster
2010-02-07 14:56 ` Wolfgang Schuster
0 siblings, 1 reply; 7+ messages in thread
From: Peter Münster @ 2010-02-07 14:26 UTC (permalink / raw)
To: mailing list for ConTeXt users
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/
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: simple usage of \hpos
2010-02-07 14:26 ` Peter Münster
@ 2010-02-07 14:56 ` Wolfgang Schuster
2010-02-07 15:28 ` Peter Münster
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2010-02-07 14:56 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 07.02.10 15:26, schrieb Peter Münster:
> \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}}
\def\doPlaceAtPos[#1]#2%
{\dowithnextbox
{\setlayer
[myBG]
[x=\the\dimexpr\MPx{#2}-\nextboxwd/2\relax,
y=\the\dimexpr\paperheight-\MPy{#2}-\nextboxht\relax,
#1]
{\flushnextbox}}
\normalhbox}
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: simple usage of \hpos
2010-02-07 14:56 ` Wolfgang Schuster
@ 2010-02-07 15:28 ` Peter Münster
0 siblings, 0 replies; 7+ messages in thread
From: Peter Münster @ 2010-02-07 15:28 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, Feb 07 2010, Wolfgang Schuster wrote:
>> \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}}
>
> \def\doPlaceAtPos[#1]#2%
> {\dowithnextbox
> {\setlayer
> [myBG]
> [x=\the\dimexpr\MPx{#2}-\nextboxwd/2\relax,
> y=\the\dimexpr\paperheight-\MPy{#2}-\nextboxht\relax,
> #1]
> {\flushnextbox}}
> \normalhbox}
Thank you for this \dowithnextbox command!
(I keep \getparameters... because I want to use it for other parameters
outside of \setlayer)
Cheers, Peter
--
Contact information: http://pmrb.free.fr/contact/
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-02-07 15:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-06 22:17 simple usage of \hpos Peter Münster
2010-02-07 8:42 ` Wolfgang Schuster
2010-02-07 12:22 ` Peter Münster
2010-02-07 12:46 ` Wolfgang Schuster
2010-02-07 14:26 ` Peter Münster
2010-02-07 14:56 ` Wolfgang Schuster
2010-02-07 15:28 ` Peter Münster
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).