ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Center (horizontal + vertical) an image in \setframed
@ 2011-12-31 14:33 Jan Heinen
  2011-12-31 14:44 ` luigi scarso
  2012-01-01  9:23 ` Center (horizontal + vertical) an image in \setframed Wolfgang Schuster
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Heinen @ 2011-12-31 14:33 UTC (permalink / raw)
  To: ntg-context

Hello

I want to center (horizontal and vertical) an image in a frame.
1. What Do I have to add?

     \setlayerframed [Kontaktdaten]
       [
     width=120mm,
     height=120mm,
     hoffset=50mm,
     voffset=50mm
       ]
       [strut=no,offset=overlay,frame=on]
       {\externalfigure[cow][width=100mm,height=100mm]}%



2. This is a complete example. I used a second \setframed to 
show the area in which the cow should be centered and middled:



\definelayer    [Kontaktdaten]
         [x=0mm, y=0mm,
         width=\paperwidth, height=\paperheight]
\setupbackgrounds [paper]
   [
     background=Kontaktdaten,
     state=start
   ]%
\starttext
     \setlayerframed [Kontaktdaten]
       [
     width=120mm,
     height=120mm,
     hoffset=50mm,
     voffset=50mm
       ]
       [strut=no,offset=overlay,frame=on]
       {\framed [width=120mm, height=120mm]{~}}%

     \setlayerframed [Kontaktdaten]
       [
     width=120mm,
     height=120mm,
     hoffset=50mm,
     voffset=50mm
       ]
       [strut=no,offset=overlay,frame=on]
       {\externalfigure[cow][width=100mm,height=100mm]}%

test
\page
\stoptext



I wish You a Happy New Year
Jannis

___________________________________________________________________________________
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] 8+ messages in thread

* Re: Center (horizontal + vertical) an image in \setframed
  2011-12-31 14:33 Center (horizontal + vertical) an image in \setframed Jan Heinen
@ 2011-12-31 14:44 ` luigi scarso
  2011-12-31 17:48   ` Jan Heinen
  2012-01-01  9:23 ` Center (horizontal + vertical) an image in \setframed Wolfgang Schuster
  1 sibling, 1 reply; 8+ messages in thread
From: luigi scarso @ 2011-12-31 14:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, Dec 31, 2011 at 3:33 PM, Jan Heinen <JaHeinen@gmx.de> wrote:
> Hello
>
> I want to center (horizontal and vertical) an image in a frame.
> 1. What Do I have to add?
>
>    \setlayerframed [Kontaktdaten]
>      [
>    width=120mm,
>    height=120mm,
>    hoffset=50mm,
>    voffset=50mm
>      ]
>      [strut=no,offset=overlay,frame=on]
>      {\externalfigure[cow][width=100mm,height=100mm]}%
>
>
>
> 2. This is a complete example. I used a second \setframed to show the area
> in which the cow should be centered and middled:
>
>
>
> \definelayer    [Kontaktdaten]
>        [x=0mm, y=0mm,
>        width=\paperwidth, height=\paperheight]
> \setupbackgrounds [paper]
>  [
>    background=Kontaktdaten,
>    state=start
>  ]%
> \starttext
>    \setlayerframed [Kontaktdaten]
>      [
>    width=120mm,
>    height=120mm,
>    hoffset=50mm,
>    voffset=50mm
>      ]
>      [strut=no,offset=overlay,frame=on]
>      {\framed [width=120mm, height=120mm]{}%
>
>    \setlayerframed [Kontaktdaten]
>      [
>    width=120mm,
>    height=120mm,
>    hoffset=50mm,
>    voffset=50mm
>      ]
>      [strut=no,offset=overlay,frame=on]
>      {\externalfigure[cow][width=100mm,height=100mm]}%
>
> test
> \page
> \stoptext
>
>
>
> I wish You a Happy New Year
> Jannis
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


You have missed a '}'...
Anyway, this is a "TeX" solution



\definelayer    [Kontaktdaten]       [x=0mm, y=0mm,
width=\paperwidth, height=\paperheight]\setupbackgrounds [paper] [
background=Kontaktdaten,   state=start ]%\starttext   \setlayerframed
[Kontaktdaten]     [   width=120mm,   height=120mm,   hoffset=50mm,
voffset=50mm     ]     [strut=no,offset=overlay,frame=on]     {\framed
[width=120mm, height=120mm]{}}%<-- brace missed here
   \setlayerframed [Kontaktdaten]     [   width=120mm,   height=120mm,
  hoffset=50mm,   voffset=50mm     ]
[strut=no,offset=overlay,frame=on]     {\vbox to 120mm{\vss\hbox to
120mm{\hss\externalfigure[cow][frame=on,width=100mm,height=100mm]\hss}\vss}}%
test\page\stoptext
-- 
luigi
___________________________________________________________________________________
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] 8+ messages in thread

* Re: Center (horizontal + vertical) an image in \setframed
  2011-12-31 14:44 ` luigi scarso
@ 2011-12-31 17:48   ` Jan Heinen
  2012-01-02 16:21     ` Pagereferences to more than one page Jan Heinen
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Heinen @ 2011-12-31 17:48 UTC (permalink / raw)
  To: ntg-context

Dear luigi,

 > You have missed a '}'...

I didn't forget the brace. In the eMail I sent to the 
mailinglist there was a
leftbrace tilde rightbrace rightbrace

"tilde rightbrace" were eaten by the internet :-(


Thanxs for the solution with hss and vss
Jannis

___________________________________________________________________________________
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] 8+ messages in thread

* Re: Center (horizontal + vertical) an image in \setframed
  2011-12-31 14:33 Center (horizontal + vertical) an image in \setframed Jan Heinen
  2011-12-31 14:44 ` luigi scarso
@ 2012-01-01  9:23 ` Wolfgang Schuster
  1 sibling, 0 replies; 8+ messages in thread
From: Wolfgang Schuster @ 2012-01-01  9:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 31.12.2011 um 15:33 schrieb Jan Heinen:

> Hello
> 
> I want to center (horizontal and vertical) an image in a frame.
> 
> 2. This is a complete example. I used a second \setframed to show the area in which the cow should be centered and middled:
> 
> \definelayer    [Kontaktdaten]
>        [x=0mm, y=0mm,
>        width=\paperwidth, height=\paperheight]
> \setupbackgrounds [paper]

Do you know the difference between “paper” and “page”?

>  [
>    background=Kontaktdaten,
>    state=start
>  ]%
> \starttext
>    \setlayerframed [Kontaktdaten]
>      [
>    width=120mm,
>    height=120mm,
>    hoffset=50mm,
>    voffset=50mm
>      ]
>      [strut=no,offset=overlay,frame=on]
>      {\framed [width=120mm, height=120mm]{~}}%
> 
>    \setlayerframed [Kontaktdaten]
>      [
>    width=120mm,
>    height=120mm,
>    hoffset=50mm,
>    voffset=50mm
>      ]
>      [strut=no,offset=overlay,frame=on]
>      {\externalfigure[cow][width=100mm,height=100mm]}%
> 
> test
> \page
> \stoptext

\definelayer[Kontaktdaten][width=\paperwidth, height=\paperheight]

\setupbackgrounds[page][background=Kontaktdaten]

\starttext

\setlayerframed
  [Kontaktdaten]
  [hoffset=50mm,
   voffset=50mm]
  [width=120mm,
   height=120mm,
   strut=no,
   frame=on]
  {\externalfigure[cow][width=100mm,height=100mm,frame=on]}%

\dontleavehmode\page

\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] 8+ messages in thread

* Re: Pagereferences to more than one page
  2011-12-31 17:48   ` Jan Heinen
@ 2012-01-02 16:21     ` Jan Heinen
  2012-01-02 16:29       ` Hans Hagen
  2012-01-02 16:30       ` luigi scarso
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Heinen @ 2012-01-02 16:21 UTC (permalink / raw)
  To: ntg-context

Though I searched a lot for the question in the bottom,
- I could not find a parameter for \at which solves my problem
- I could not find any other command which helps me

Is this a limitation of ConText? I can't imagin that I am 
the only one and first who wants to reference to more than 
one page.

Regards, Jannis

===== Copy
I want to reference to more than one page. In the exampe 
above only page 2 is referenced - how to get 2,4 ?

\starttext
You can find red vehicles on \at{page:}[red]


Here I want to see: "You can find red vehicles on page 2,4" 
(only page 2 is wrong)

\page

\pagereference[red]Here is a red car.
\page

\pagereference[green]Here is a green car.
\page

\pagereference[red]Here is a red bus.
\page

\pagereference[green]Here is a green car.
\page

\stoptext




___________________________________________________________________________________
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] 8+ messages in thread

* Re: Pagereferences to more than one page
  2012-01-02 16:21     ` Pagereferences to more than one page Jan Heinen
@ 2012-01-02 16:29       ` Hans Hagen
  2012-01-02 16:30       ` luigi scarso
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2012-01-02 16:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jan Heinen

On 2-1-2012 17:21, Jan Heinen wrote:
> Though I searched a lot for the question in the bottom,
> - I could not find a parameter for \at which solves my problem
> - I could not find any other command which helps me
>
> Is this a limitation of ConText? I can't imagin that I am the only one
> and first who wants to reference to more than one page.
>
> Regards, Jannis
>
> ===== Copy
> I want to reference to more than one page. In the exampe above only page
> 2 is referenced - how to get 2,4 ?
>
> \starttext
> You can find red vehicles on \at{page:}[red]
>
>
> Here I want to see: "You can find red vehicles on page 2,4" (only page 2
> is wrong)
>
> \page
>
> \pagereference[red]Here is a red car.
> \page
>
> \pagereference[green]Here is a green car.
> \page
>
> \pagereference[red]Here is a red bus.
> \page
>
> \pagereference[green]Here is a green car.
> \page

that won't work as references need to be unique

[green-1]
[green-2]

etc


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 8+ messages in thread

* Re: Pagereferences to more than one page
  2012-01-02 16:21     ` Pagereferences to more than one page Jan Heinen
  2012-01-02 16:29       ` Hans Hagen
@ 2012-01-02 16:30       ` luigi scarso
  2012-01-02 18:28         ` luigi scarso
  1 sibling, 1 reply; 8+ messages in thread
From: luigi scarso @ 2012-01-02 16:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Jan 2, 2012 at 5:21 PM, Jan Heinen <JaHeinen@gmx.de> wrote:
> Though I searched a lot for the question in the bottom,
> - I could not find a parameter for \at which solves my problem
> - I could not find any other command which helps me
>
> Is this a limitation of ConText? I can't imagin that I am the only one and
> first who wants to reference to more than one page.
I'm working on this
but the idea of reference is that there is exactly one label for an
object (which can be the same)
so that \pagereference[red]foo
\pagereference[red]boo
is wrong because the label red has more than one reference, while
 \pagereference[red:1]foo
\pagereference[red:2]foo
is ok (as hans said).
What you need is a register --- they are used in to build the Index :
see
http://wiki.contextgarden.net/Registers

-- 
luigi
___________________________________________________________________________________
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] 8+ messages in thread

* Re: Pagereferences to more than one page
  2012-01-02 16:30       ` luigi scarso
@ 2012-01-02 18:28         ` luigi scarso
  0 siblings, 0 replies; 8+ messages in thread
From: luigi scarso @ 2012-01-02 18:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4135 bytes --]

On Mon, Jan 2, 2012 at 5:30 PM, luigi scarso <luigi.scarso@gmail.com> wrote:

> On Mon, Jan 2, 2012 at 5:21 PM, Jan Heinen <JaHeinen@gmx.de> wrote:
> > Though I searched a lot for the question in the bottom,
> > - I could not find a parameter for \at which solves my problem
> > - I could not find any other command which helps me
> >
> > Is this a limitation of ConText? I can't imagin that I am the only one
> and
> > first who wants to reference to more than one page.
> I'm working on this
> but the idea of reference is that there is exactly one label for an
> object (which can be the same)
> so that \pagereference[red]foo
> \pagereference[red]boo
> is wrong because the label red has more than one reference, while
>  \pagereference[red:1]foo
> \pagereference[red:2]foo
> is ok (as hans said).
>

Using this idea, and the two pass way, we can wrap \pagereference and \at
with \PageReference and \At,
wheret \PageReference[red] really means \pagereference[red:1],
\pagereference[red:2] and so on,
while \At{page:}[red] put \at{page:}[red:],\at{}[red:2] and so on.
After the end of the first pass we store the multiple references into
multiref.tuc, and we read this file at the beginning of every other pass;
its data is used by \At
to put the correct reference.

This is not a good solution, because multiref.tuc must be keep in synch
with the tuc file of the source, so context ---purgeall must be call to
clean up temporary data and restart.
The ideal solution store these data into the tuc file --- context has
 core-two.lua and core-two.mkiv for this, if I've time I will fix.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\startluacode
document.jan =  document.jan or {}
document.jan.multiple_references =  document.jan.multiple_references or {}
document.jan.multiple_references_stored =
 document.jan.multiple_references_stored or {}
\stopluacode


\def\WriteToList{%
\startluacode
local f=io.open('multiref.tuc','r')
if f==nil then
 f=io.open('multiref.tuc','w')
 f:write("local multiple_references= multiple_references or {}\n")
 f:write("multiple_references={\n")
 for k,v in pairs(document.jan.multiple_references) do
    f:write(string.format("['\%s']=\%s,\n",k,v))
 end
 f:write("}\n")
 f:write("return multiple_references\n")
end
\stopluacode
}
\appendtoks\WriteToList\to\everystoptext


\def\ReadList{%
\startluacode
local f=io.open('multiref.tuc','r')
if f~=nil then
 f:close()
 document.jan.multiple_references_stored=dofile('multiref.tuc')
end
\stopluacode
}
\appendtoks\ReadList\to\everystarttext



%% wrap \pagereference
\def\PageReference[#1]{%
\startluacode
if document.jan.multiple_references['#1'] == nil then
  document.jan.multiple_references['#1'] = 1
 else
  document.jan.multiple_references['#1'] =
document.jan.multiple_references['#1'] +1
end
context('\\pagereference[#1:\%d]',document.jan.multiple_references['#1'])
\stopluacode%
}

%% wrap \at
\def\At#1[#2]{%
\startluacode
print('>>>>> ',document.jan.multiple_references['#2'])
if document.jan.multiple_references_stored['#2'] == nil then
 context('\\at{#1}[#2]')
else
  for j=1,document.jan.multiple_references_stored['#2'] do
    local ref=string.format('#2:\%d',j)
    local comma = ','
    if j==1 and document.jan.multiple_references_stored['#2']==1 then
context('\\at{#1}[\%s]',ref) end
    if j==1 and document.jan.multiple_references_stored['#2']~=1 then
      context('\\at{#1}[\%s],',ref)
    elseif 1<j and j<document.jan.multiple_references_stored['#2'] then
      context('\\at{}[\%s],',ref)
    elseif j== document.jan.multiple_references_stored['#2'] and
 document.jan.multiple_references_stored['#2']>1 then
     context('\\at{}[\%s]',ref)
    end
  end
end
\stopluacode
}

\starttext
You can find red vehicles on \At{page:}[red]
You can find yellow vehicles on \At{page:}[yellow]

Here I want to see: "You can find red vehicles on page 2,4" (only page 2 is
wrong)
\page

\PageReference[red]Here is a red car.
\page

\PageReference[green]Here is a green car.
\page

\PageReference[red]Here is a red bus.
\page

\PageReference[green]Here is a green car.
\page

\PageReference[yellow]Here is a yellow car.
\page



\stoptext


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 14027 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 8+ messages in thread

end of thread, other threads:[~2012-01-02 18:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-31 14:33 Center (horizontal + vertical) an image in \setframed Jan Heinen
2011-12-31 14:44 ` luigi scarso
2011-12-31 17:48   ` Jan Heinen
2012-01-02 16:21     ` Pagereferences to more than one page Jan Heinen
2012-01-02 16:29       ` Hans Hagen
2012-01-02 16:30       ` luigi scarso
2012-01-02 18:28         ` luigi scarso
2012-01-01  9:23 ` Center (horizontal + vertical) an image in \setframed Wolfgang Schuster

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).