Re: [NTG-context] Images centered on page

2007-11-24 Thread Wolfgang Schuster
On Fri, 23 Nov 2007 22:32:46 -0700
Idris Samawi Hamid [EMAIL PROTECTED] wrote:

 On Fri, 23 Nov 2007 12:30:48 -0700, Wolfgang Schuster  
 [EMAIL PROTECTED] wrote:
 
  \unprotect
 
  \def\fullpagebox
{\bgroup
 \dowithnextbox
   {\!!widtha\dimexpr\paperwidth/\nextboxwd\relax
\!!widthb\dimexpr\paperheight/\nextboxht\relax
\ifdim\!!widtha\!!widthb
  
  \setbox\nextbox\vbox\!!to\paperheight{\vss\expanded{\scale[\c!width=\paperwidth]{\flushnextbox}}\vss}%
\else
  
  \setbox\nextbox\hbox\!!to\paperwidth{\hss\expanded{\scale[\c!height=\paperheight]{\flushnextbox}}\hss}%
\fi  
  \setbox\nextbox\hbox{\clip[\c!width=\paperwidth,\c!height=\paperheight]{\flushnextbox}}%
\startTEXpage
\flushnextbox
\stopTEXpage
\egroup}
 \hbox}
 
  \protect
 
  \starttext
 
  \fullpagebox{\externalfigure[image]}
 
  \stoptext
 
 Now THAT's the 1st-class gangster we know and love so much ;-)
 
 Question: How can we, if desired, fit the image to the page dimensions?  
 See what happens with
 
 \starttext
 
 \fullpagebox{\externalfigure[cow][scale=fit]}
 
 \stoptext

Can you try \pagefigure, my solution was to scale a image to the
papersize and remove parts. \pagefigure includes a figure within a
TEXpage and you scale now the figure to the size of the document.

\starttext

\pagefigure[cow][width=\paperwidth,height=\paperheight]

\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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page : Solved

2007-11-24 Thread Wolfgang Schuster
On Fri, 23 Nov 2007 23:50:42 +0100
luigi scarso [EMAIL PROTECTED] wrote:

 On Nov 23, 2007 9:39 PM, Vyatcheslav Yatskovsky [EMAIL PROTECTED] wrote:
  Hello,
 
  Thank you all very much. I'm pleased with number and quality of solutions 
  to my problem.
 Did you look in supp-box at centerbox definition ?
 it' something like
 \vbox to \adimension{\vfill \vfill}
 (well, not \vfill, but \vss)
 
 You approach was not so distant to solutions , you only forget that
 \vfill need a bit of attention.
 (hey even today sometimes i'm lost with \def and \edef...)
 
 Compare
 \starttext
 \vfill
 a
 \vfill
 \stoptext
 
 with
 \starttext
 \hskip1sp
 \vfill
 a
 \vfill
 \stoptext
 
 Given that 1sp is invisible to human eye ,
 one can appreciate here a butterfly effect :))

Hi Luigi,

you can use \dontleavehmode in this case.

\starttext
\dontleavehmode\vfill
a
\vfill
\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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page : Solved

2007-11-24 Thread luigi scarso
 you can use \dontleavehmode in this case.
yes, i know.

\meaning\ \dontleavehmode
gives
\quitvmode

\meaning\quitvmode
gives
\quitvmode
hence \quitvmode is a primitive .

\quitvmode
The primitive instructs pdfTEX to quit the vertical mode and start
typesetting a paragraph. \quitvmode
has the same effect as \leavevmode definition from plain macro
package. Note however, that
\leavevmode may conflict with \everypar tokens list. No such risk
while using \quitvmode instead
The primitive has been introduced in pdfTEX 1.21a.

\hskip1sp give more the sense of invisible touch ...


-- 
luigi
...
it's new .
it's powerful .
it's luatex .
http://www.luatex.org
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Wolfgang Schuster
On Fri, 23 Nov 2007 18:55:37 +0200
Vyatcheslav Yatskovsky [EMAIL PROTECTED] wrote:

 Hello,
 
 How can I center the image on a page? I want images to cover the page 
 completely, and since they have proper size (roughly A4), I only need them to 
 be centered. Now they are stuck to the top, leaving a gap on bottom (and same 
 for left-right).
 
 I have the following script (note my Lua trick to process images in a batch). 
 Image names are Image1.png and so on.
 
 
 %engine=luatex
 \setuplayout
   [footer=0mm, header=0mm,
   topspace=0mm, backspace=0mm,
   leftmargin=0mm, rightmargin=0mm,
   location=middle,
   height=fit, width=fit]
 
 \starttext
 
 \startluacode
   for n = 1, 9 do
 tex.print(string.format(\\externalfigure[Image%05d.png], n)); 
   end
 \stopluacode
 
 \stoptext

\def\fivedigits#1%
  {\ifnum#11 0\ifnum#11000 0\ifnum#1100 0\ifnum#110 0\fi\fi\fi
\fi\number#1}

\dorecurse{9}
  {\startTEXpage[width=210mm,height=297mm]
   \centeredbox{\externalfigure[Image-\fivedigits\recurselevel]}
   \stopTEXpage}

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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Wolfgang Schuster
2007/11/23, Vyatcheslav Yatskovsky [EMAIL PROTECTED]:
 Hello,

 How can I center the image on a page? I want images to cover the page 
 completely, and since they have proper size (roughly A4), I only need them to 
 be centered. Now they are stuck to the top, leaving a gap on bottom (and same 
 for left-right).

 I have the following script (note my Lua trick to process images in a batch). 
 Image names are Image1.png and so on.


 %engine=luatex
 \setuplayout
   [footer=0mm, header=0mm,
   topspace=0mm, backspace=0mm,
   leftmargin=0mm, rightmargin=0mm,
   location=middle,
   height=fit, width=fit]

 \starttext

 \startluacode
   for n = 1, 9 do
 tex.print(string.format(\\externalfigure[Image%05d.png], n));
   end
 \stopluacode

 \stoptext

your mail remind me to something I wanted a long time ago but I was now
motivated enough to write it. Below is solution to fit a given image to
a page with the normal width and height but remove parts at the top and
bottom or left and right if the width height relation is different from
the one of the document.

I think Hans would be ablo to write a better solution but this all I
can do by myself at the moment.

\unprotect

\def\fullpagebox
  {\bgroup
   \dowithnextbox
 {\!!widtha\dimexpr\paperwidth/\nextboxwd\relax
  \!!widthb\dimexpr\paperheight/\nextboxht\relax
  \ifdim\!!widtha\!!widthb

\setbox\nextbox\vbox\!!to\paperheight{\vss\expanded{\scale[\c!width=\paperwidth]{\flushnextbox}}\vss}%
  \else

\setbox\nextbox\hbox\!!to\paperwidth{\hss\expanded{\scale[\c!height=\paperheight]{\flushnextbox}}\hss}%
  \fi 
\setbox\nextbox\hbox{\clip[\c!width=\paperwidth,\c!height=\paperheight]{\flushnextbox}}%
  \startTEXpage
  \flushnextbox
  \stopTEXpage
  \egroup}
   \hbox}

\protect

\starttext

\fullpagebox{\externalfigure[image]}

\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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page : Solved

2007-11-23 Thread luigi scarso
On Nov 23, 2007 9:39 PM, Vyatcheslav Yatskovsky [EMAIL PROTECTED] wrote:
 Hello,

 Thank you all very much. I'm pleased with number and quality of solutions to 
 my problem.
Did you look in supp-box at centerbox definition ?
it' something like
\vbox to \adimension{\vfill \vfill}
(well, not \vfill, but \vss)

You approach was not so distant to solutions , you only forget that
\vfill need a bit of attention.
(hey even today sometimes i'm lost with \def and \edef...)

Compare
\starttext
\vfill
a
\vfill
\stoptext

with
\starttext
\hskip1sp
\vfill
a
\vfill
\stoptext

Given that 1sp is invisible to human eye ,
one can appreciate here a butterfly effect :))

-- 
luigi
...
it's new .
it's powerful .
it's luatex .
http://www.luatex.org
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Idris Samawi Hamid
On Fri, 23 Nov 2007 12:30:48 -0700, Wolfgang Schuster  
[EMAIL PROTECTED] wrote:

 \unprotect

 \def\fullpagebox
   {\bgroup
\dowithnextbox
  {\!!widtha\dimexpr\paperwidth/\nextboxwd\relax
   \!!widthb\dimexpr\paperheight/\nextboxht\relax
   \ifdim\!!widtha\!!widthb
 
 \setbox\nextbox\vbox\!!to\paperheight{\vss\expanded{\scale[\c!width=\paperwidth]{\flushnextbox}}\vss}%
   \else
 
 \setbox\nextbox\hbox\!!to\paperwidth{\hss\expanded{\scale[\c!height=\paperheight]{\flushnextbox}}\hss}%
   \fi  
 \setbox\nextbox\hbox{\clip[\c!width=\paperwidth,\c!height=\paperheight]{\flushnextbox}}%
   \startTEXpage
   \flushnextbox
   \stopTEXpage
   \egroup}
\hbox}

 \protect

 \starttext

 \fullpagebox{\externalfigure[image]}

 \stoptext

Now THAT's the 1st-class gangster we know and love so much ;-)

Question: How can we, if desired, fit the image to the page dimensions?  
See what happens with

\starttext

\fullpagebox{\externalfigure[cow][scale=fit]}

\stoptext

Idris

-- 
Professor Idris Samawi Hamid, Editor-in-Chief
International Journal of Shi`i Studies
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread luigi scarso
amazing mailing list


-- 
luigi
...
it's new .
it's powerful .
it's luatex .
http://www.luatex.org
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Idris Samawi Hamid
On Fri, 23 Nov 2007 10:31:08 -0700, luigi scarso [EMAIL PROTECTED]  
wrote:

 On Nov 23, 2007 6:24 PM, Vyatcheslav Yatskovsky [EMAIL PROTECTED]  
 wrote:
 Hello Idris,

 Thank you.

 What is display mode?  Simply

 \vfill\externalfigure[Image1.jpg]\vfill

 \vbox to  
 \textheight{\vfill\vskip1sp\externalfigure[Image1.jpg]\vskip1sp\vfill}

Alternatively, \vfill + display mode

\leavevmode\vfill$$\externalfigure[cow.pdf]$$\vfill

:-)

Idris

-- 
Professor Idris Samawi Hamid, Editor-in-Chief
International Journal of Shi`i Studies
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Peter Münster
On Fri, 23 Nov 2007, Vyatcheslav Yatskovsky wrote:

 How can I center the image on a page?

\setuplayout[page]
\starttext
\startstandardmakeup
\startalignment[middle]
\dontleavehmode
\externalfigure[image.png]
\stopalignment
\stopstandardmakeup
\stoptext

Cheers, Peter

-- 
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread luigi scarso
On Nov 23, 2007 6:24 PM, Vyatcheslav Yatskovsky [EMAIL PROTECTED] wrote:
 Hello Idris,

 Thank you.

 What is display mode?  Simply

 \vfill\externalfigure[Image1.jpg]\vfill

\vbox to 
\textheight{\vfill\vskip1sp\externalfigure[Image1.jpg]\vskip1sp\vfill}




-- 
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Images centered on page

2007-11-23 Thread Vyatcheslav Yatskovsky
Hello,

How can I center the image on a page? I want images to cover the page 
completely, and since they have proper size (roughly A4), I only need them to 
be centered. Now they are stuck to the top, leaving a gap on bottom (and same 
for left-right).

I have the following script (note my Lua trick to process images in a batch). 
Image names are Image1.png and so on.


%engine=luatex
\setuplayout
  [footer=0mm, header=0mm,
  topspace=0mm, backspace=0mm,
  leftmargin=0mm, rightmargin=0mm,
  location=middle,
  height=fit, width=fit]

\starttext

\startluacode
  for n = 1, 9 do
tex.print(string.format(\\externalfigure[Image%05d.png], n)); 
  end
\stopluacode

\stoptext


Best regards,
Vyatcheslav

___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Idris Samawi Hamid
On Fri, 23 Nov 2007 10:46:16 -0700, Peter Münster [EMAIL PROTECTED] wrote:

 On Fri, 23 Nov 2007, Vyatcheslav Yatskovsky wrote:

 How can I center the image on a page?

 \setuplayout[page]
 \starttext
 \startstandardmakeup
 \startalignment[middle]
 \dontleavehmode
 \externalfigure[image.png]
 \stopalignment
 \stopstandardmakeup
 \stoptext

Yes! Now let's make it even simpler:

\starttext
\startstandardmakeup
\midaligned{\externalfigure[cow.pdf]}
\stopstandardmakeup
\stoptext

Best
Idris

-- 
Professor Idris Samawi Hamid, Editor-in-Chief
International Journal of Shi`i Studies
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Idris Samawi Hamid
On Fri, 23 Nov 2007 09:55:37 -0700, Vyatcheslav Yatskovsky  
[EMAIL PROTECTED] wrote:

 Hello,

 How can I center the image on a page? I want images to cover the page  
 completely, and since they have proper size (roughly A4), I only need  
 them to be centered. Now they are stuck to the top, leaving a gap on  
 bottom (and same for left-right).

Did you try display mode? \vfill arg \vfill? I guess I don't see the  
complication... :-)

Best
Idris

-- 
Professor Idris Samawi Hamid, Editor-in-Chief
International Journal of Shi`i Studies
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Vyatcheslav Yatskovsky
Hello Idris,

Thank you. 

What is display mode?  Simply 

\vfill\externalfigure[Image1.jpg]\vfill

doesn't work for me.


-- 
Best regards,
Vyatcheslav Yatskovsky


 Hello,

 How can I center the image on a page? I want images to cover the page  
 completely, and since they have proper size (roughly A4), I only need  
 them to be centered. Now they are stuck to the top, leaving a gap on  
 bottom (and same for left-right).

 Did you try display mode? \vfill arg \vfill? I guess I don't see the
 complication...  

 Best
 Idris

___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Images centered on page

2007-11-23 Thread Idris Samawi Hamid
On Fri, 23 Nov 2007 10:24:35 -0700, Vyatcheslav Yatskovsky  
[EMAIL PROTECTED] wrote:

 Hello Idris,

 Thank you.

 What is display mode?  Simply

 \vfill\externalfigure[Image1.jpg]\vfill

 doesn't work for me.

Try $$arg$$.

I'm sure there's a ConTeXt-ish solution for this as well (in addition to  
luigi's solution), can't check at the moment... Where are you, Wolfgang?

Best
Idris

-- 
Professor Idris Samawi Hamid, Editor-in-Chief
International Journal of Shi`i Studies
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Images centered on page : Solved

2007-11-23 Thread Vyatcheslav Yatskovsky
Hello,

Thank you all very much. I'm pleased with number and quality of solutions to my 
problem.

The winner solution is provided by Wolfgang Schuster.  Simple \centeredbox{} 
makes all the magic I need.

I was also amazed with quick porting of my Lua code for batch image processing 
to native TeX script. I'm an imperative programmer to the marrow and never will 
be able to do such things. Luckily, now we have embedded Lua!

Best regards,
Vyatcheslav Yatskovsky


___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___