fitting a picture to the available space
Hi guys, I'm pulling my hair out. I'm trying to set up an automatism to fit pictures to the available space on a slide. I need to consider three parameters: 1. If the user supplies a value for width= or height= , use this value (captured in a macro); 2. respect the maxwidth and maxheight which must not exceed the frame; 3. if the picture is smaller than the available space, blow it up so that it reaches the maxwidth or maxheight (but doesn't exceed either). factor=max or =fit does not work because it allows pictures to exceed one of the maximum values. About a year ago Giuseppe Bilotta wrote a message which I append; it describes my problem. Is there a generic solution for this problem? If there is, I'll gladly take it; if there isn't, I thought I had a solution but may need help with expanding and conditionals, then I'll be back with more questions. Anyway, good night all, and thanks. Thomas
Subject: Re: [NTG-context] factor=fit images don't fit Sunday, July 22, 2007 Hans Hagen wrote:
the fit assumes operating on a page not in a box;
Ah, didn't know that. I couldn't even tell from the sources, since it uses enclosing box dimensions and not page or paper sizes. I suspect the logic is broken at the page level too though, let me explain why.
Currently, if I understand the code correctly, factor=fit expands the figure to have its major direction fit, while factor=max expands the figure to have its minor direction fit.
Instead, the behavior I would expect from fit (resp. max) is for the *expansion ratio* to be the minimum (resp. maximum) of the expansion ratios in the two directions (not the sizes in those directions, but the ratio between the sizes of the figure and the container). The difference is noticeable when the container and contained have different aspect ratios.
Consider for example a 20x30mm figure in a 50x150mm page (strange numbers, just used to show what I mean): with the current code, using 'fit' would consider the largest dimension (30) and thus calculate a factor of 150/30 = 5, but this gives us an image which is 100x150mm, i.e. an image that doesn't fit! Whereas, if we computed the ratios 50/20 = 2.5 and 150/30 = 5, we would know that the ratio to be picked was 2.5 in 'fit' and 5 in 'max'.
Or I misintepreting the meaning of 'fit' and 'max'?
an alternative is:
\framed[width=5cm,height4cm]
{\externalfigure[mill.png][maxwidth=4cm,maxheight=5cm,width=10cm]}
i.e. setting the maximum values
I hadn't thought about using width and maxwidth (and maxheight) at the same time, thanks. Of course, I'd rather have 'fit' and 'max' usable in boxes :)
Thomas A. Schmitz wrote:
Hi guys,
I'm pulling my hair out. I'm trying to set up an automatism to fit pictures to the available space on a slide. I need to consider three parameters:
1. If the user supplies a value for width= or height= , use this value (captured in a macro);
2. respect the maxwidth and maxheight which must not exceed the frame;
3. if the picture is smaller than the available space, blow it up so that it reaches the maxwidth or maxheight (but doesn't exceed either).
factor=max or =fit does not work because it allows pictures to exceed one of the maximum values. About a year ago Giuseppe Bilotta wrote a message which I append; it describes my problem. Is there a generic solution for this problem? If there is, I'll gladly take it; if there isn't, I thought I had a solution but may need help with expanding and conditionals, then I'll be back with more questions.
Anyway, good night all, and thanks.
\starttext \framed[width=5cm,height4cm]{\externalfigure[mill.png][maxwidth=3cm,maxheight=4cm,width=10cm]} \stoptext seems to work
Thomas
Subject: Re: [NTG-context] factor=fit images don't fit Sunday, July 22, 2007 Hans Hagen wrote:
the fit assumes operating on a page not in a box; Ah, didn't know that. I couldn't even tell from the sources, since it uses enclosing box dimensions and not page or paper sizes. I suspect the logic is broken at the page level too though, let me explain why.
Currently, if I understand the code correctly, factor=fit expands the figure to have its major direction fit, while factor=max expands the figure to have its minor direction fit.
Instead, the behavior I would expect from fit (resp. max) is for the *expansion ratio* to be the minimum (resp. maximum) of the expansion ratios in the two directions (not the sizes in those directions, but the ratio between the sizes of the figure and the container). The difference is noticeable when the container and contained have different aspect ratios.
Consider for example a 20x30mm figure in a 50x150mm page (strange numbers, just used to show what I mean): with the current code, using 'fit' would consider the largest dimension (30) and thus calculate a factor of 150/30 = 5, but this gives us an image which is 100x150mm, i.e. an image that doesn't fit! Whereas, if we computed the ratios 50/20 = 2.5 and 150/30 = 5, we would know that the ratio to be picked was 2.5 in 'fit' and 5 in 'max'.
Or I misintepreting the meaning of 'fit' and 'max'?
an alternative is: \framed[width=5cm,height4cm]
{\externalfigure[mill.png][maxwidth=4cm,maxheight=5cm,width=10cm]} i.e. setting the maximum values I hadn't thought about using width and maxwidth (and maxheight) at the same time, thanks. Of course, I'd rather have 'fit' and 'max' usable in boxes :)
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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sep 11, 2008, at 9:28 AM, Hans Hagen wrote:
\starttext
\framed[width=5cm,height4cm]{\externalfigure[mill.png] [maxwidth=3cm,maxheight=4cm,width=10cm]}
\stoptext
seems to work
Ah of course! I could set the width to an absurdly high number and so make sure that it will always reach the maxheight/maxwidth, no matter what the ratio! This seems to work, thanks a lot! Thomas
On Sep 11, 2008, at 10:04 AM, Thomas A. Schmitz wrote:
On Sep 11, 2008, at 9:28 AM, Hans Hagen wrote:
\starttext
\framed[width=5cm,height4cm]{\externalfigure[mill.png] [maxwidth=3cm,maxheight=4cm,width=10cm]}
\stoptext
seems to work
Ah of course! I could set the width to an absurdly high number and so make sure that it will always reach the maxheight/maxwidth, no matter what the ratio! This seems to work, thanks a lot!
Alas, I spake too soon. Here is an example: \starttext \framed[frame=on,strut=no,width=8cm,height=2cm] {\externalfigure[mill.png][maxwidth=8cm,maxheight=2cm,width=10cm]} \stoptext I would expect the picture to stay within the maxheight, but it doesn't. Thomas
Thomas A. Schmitz schrieb:
On Sep 11, 2008, at 10:04 AM, Thomas A. Schmitz wrote:
On Sep 11, 2008, at 9:28 AM, Hans Hagen wrote:
\starttext
\framed[width=5cm,height4cm]{\externalfigure[mill.png] [maxwidth=3cm,maxheight=4cm,width=10cm]}
\stoptext
seems to work Ah of course! I could set the width to an absurdly high number and so make sure that it will always reach the maxheight/maxwidth, no matter what the ratio! This seems to work, thanks a lot!
Alas, I spake too soon. Here is an example:
\starttext
\framed[frame=on,strut=no,width=8cm,height=2cm] {\externalfigure[mill.png][maxwidth=8cm,maxheight=2cm,width=10cm]}
\stoptext
I would expect the picture to stay within the maxheight, but it doesn't.
Hi Thomas, I tried the above solution for the creation of figure libraries a few hours ago... with the same result. Using 'height=10cm' instead of 'width=10cm' should work in this case. At least this workaround gives the right results for my squared graphics (icons). Anyhow, this is no general solution... Best, Peter
Thomas ___________________________________________________________________________________ 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 ___________________________________________________________________________________
On Sep 11, 2008, at 4:01 PM, Peter Rolf wrote:
Hi Thomas,
I tried the above solution for the creation of figure libraries a few hours ago... with the same result. Using 'height=10cm' instead of 'width=10cm' should work in this case. At least this workaround gives the right results for my squared graphics (icons). Anyhow, this is no general solution...
Best, Peter
Hi Peter, yes, unfortunately I'm looking for a general solution for images whose dimensions and ratio are not known beforehand. Looks like we're all hitting the same snag... Best Thomas
Thomas A. Schmitz wrote:
On Sep 11, 2008, at 4:01 PM, Peter Rolf wrote:
Hi Thomas,
I tried the above solution for the creation of figure libraries a few hours ago... with the same result. Using 'height=10cm' instead of 'width=10cm' should work in this case. At least this workaround gives the right results for my squared graphics (icons). Anyhow, this is no general solution...
Best, Peter
Hi Peter,
yes, unfortunately I'm looking for a general solution for images whose dimensions and ratio are not known beforehand. Looks like we're all hitting the same snag...
the problem is that in mkii the macros involved in this are rather complex; i'm considering a pure lua solution but that would not be fully compatible with mkii (i.e. it would be more clever and precise) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Thu, Sep 11, 2008 at 3:28 PM, Thomas A. Schmitz
On Sep 11, 2008, at 10:04 AM, Thomas A. Schmitz wrote:
On Sep 11, 2008, at 9:28 AM, Hans Hagen wrote:
\starttext
\framed[width=5cm,height4cm]{\externalfigure[mill.png] [maxwidth=3cm,maxheight=4cm,width=10cm]}
\stoptext
seems to work
Ah of course! I could set the width to an absurdly high number and so make sure that it will always reach the maxheight/maxwidth, no matter what the ratio! This seems to work, thanks a lot!
Alas, I spake too soon. Here is an example:
\starttext
\framed[frame=on,strut=no,width=8cm,height=2cm] {\externalfigure[mill.png][maxwidth=8cm,maxheight=2cm,width=10cm]}
\stoptext
I would expect the picture to stay within the maxheight, but it doesn't.
You could write your own macros and comapre the width/height ration of the picture with the reation of the box, is simple example is shown below. \starttext \start \setbox\scratchbox\vbox{\externalfigure[mill]} \dimen0=\wd\scratchbox \dimen2=\ht\scratchbox \framed[frame=on,strut=no,width=8cm,height=2cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi} \framed[frame=on,strut=no,width=2cm,height=8cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi} \stop \stoptext Wolfgang
On Sep 11, 2008, at 4:13 PM, Wolfgang Schuster wrote:
On Thu, Sep 11, 2008 at 3:28 PM, Thomas A. Schmitz
wrote: On Sep 11, 2008, at 10:04 AM, Thomas A. Schmitz wrote:
On Sep 11, 2008, at 9:28 AM, Hans Hagen wrote:
\starttext
\framed[width=5cm,height4cm]{\externalfigure[mill.png] [maxwidth=3cm,maxheight=4cm,width=10cm]}
\stoptext
seems to work
Ah of course! I could set the width to an absurdly high number and so make sure that it will always reach the maxheight/maxwidth, no matter what the ratio! This seems to work, thanks a lot!
Alas, I spake too soon. Here is an example:
\starttext
\framed[frame=on,strut=no,width=8cm,height=2cm] {\externalfigure[mill.png][maxwidth=8cm,maxheight=2cm,width=10cm]}
\stoptext
I would expect the picture to stay within the maxheight, but it doesn't.
You could write your own macros and comapre the width/height ration of the picture with the reation of the box, is simple example is shown below.
\starttext
\start
\setbox\scratchbox\vbox{\externalfigure[mill]}
\dimen0=\wd\scratchbox \dimen2=\ht\scratchbox
\framed[frame=on,strut=no,width=8cm,height=2cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\framed[frame=on,strut=no,width=2cm,height=8cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\stop
\stoptext
Wolfgang
Wolfgang, as always, you're a source of wisdom and knowledge... Just I understand this correctly and can adapt it to my macro: \dimen1= \hsize: here \hsize refers to the size of the \framed inside which we're operating, right? Thomas
Thomas A. Schmitz wrote:
On Sep 11, 2008, at 4:13 PM, Wolfgang Schuster wrote:
On Sep 11, 2008, at 10:04 AM, Thomas A. Schmitz wrote:
On Sep 11, 2008, at 9:28 AM, Hans Hagen wrote:
\starttext
\framed[width=5cm,height4cm]{\externalfigure[mill.png] [maxwidth=3cm,maxheight=4cm,width=10cm]}
\stoptext
seems to work Ah of course! I could set the width to an absurdly high number and so make sure that it will always reach the maxheight/maxwidth, no matter what the ratio! This seems to work, thanks a lot!
Alas, I spake too soon. Here is an example:
\starttext
\framed[frame=on,strut=no,width=8cm,height=2cm] {\externalfigure[mill.png][maxwidth=8cm,maxheight=2cm,width=10cm]}
\stoptext
I would expect the picture to stay within the maxheight, but it doesn't. You could write your own macros and comapre the width/height ration of the
On Thu, Sep 11, 2008 at 3:28 PM, Thomas A. Schmitz
wrote: picture with the reation of the box, is simple example is shown below. \starttext
\start
\setbox\scratchbox\vbox{\externalfigure[mill]}
\dimen0=\wd\scratchbox \dimen2=\ht\scratchbox
\framed[frame=on,strut=no,width=8cm,height=2cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\framed[frame=on,strut=no,width=2cm,height=8cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\stop
\stoptext
Wolfgang
Wolfgang,
as always, you're a source of wisdom and knowledge... Just I understand this correctly and can adapt it to my macro: \dimen1= \hsize: here \hsize refers to the size of the \framed inside which we're operating, right?
be careful ... use \dimen4 and 6 instead of 1 and 3, by convention odd registers < 10 are used global ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sep 11, 2008, at 6:20 PM, Thomas A. Schmitz wrote:
\starttext
\start
\setbox\scratchbox\vbox{\externalfigure[mill]}
\dimen0=\wd\scratchbox \dimen2=\ht\scratchbox
\framed[frame=on,strut=no,width=8cm,height=2cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\framed[frame=on,strut=no,width=2cm,height=8cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\stop
\stoptext
Wolfgang
Wolfgang,
as always, you're a source of wisdom and knowledge... Just I understand this correctly and can adapt it to my macro: \dimen1= \hsize: here \hsize refers to the size of the \framed inside which we're operating, right?
And another question: I get an error "! Illegal unit of measure (pt inserted)." Is it really possible to divide a dimension by another dimension? Not according to what I read here: http://www.tug.org/utilities/plain/cseq.html#divide-rp "must be a nonzero integer." See, I'm far from being a native speaker of TeX... Best Thomas
On Sep 11, 2008, at 7:59 PM, Thomas A. Schmitz wrote:
On Sep 11, 2008, at 6:20 PM, Thomas A. Schmitz wrote:
\starttext
\start
\setbox\scratchbox\vbox{\externalfigure[mill]}
\dimen0=\wd\scratchbox \dimen2=\ht\scratchbox
\framed[frame=on,strut=no,width=8cm,height=2cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\framed[frame=on,strut=no,width=2cm,height=8cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\stop
\stoptext
Wolfgang
Wolfgang,
as always, you're a source of wisdom and knowledge... Just I understand this correctly and can adapt it to my macro: \dimen1= \hsize: here \hsize refers to the size of the \framed inside which we're operating, right?
And another question: I get an error "! Illegal unit of measure (pt inserted)." Is it really possible to divide a dimension by another dimension? Not according to what I read here: http://www.tug.org/utilities/plain/cseq.html#divide-rp "must be a nonzero integer." See, I'm far from being a native speaker of TeX...
I now have something along these lines (ugly code ahead!): \setbox\scratchbox\vbox{\externalfigure[mill]% \dimen0=\wd\scratchbox% \def\@WD{\withoutpt{\the\dimen0}}% \def\@@WD{\integerrounding{\@WD}}% \dimen4=\textwidth \divide\dimen4 by \@@WD% \dimen2=\ht\scratchbox% \def\@HT{\withoutpt{\the\dimen2}}% \def\@@HT{\integerrounding{\@HT}}% \dimen6=\textheight \divide\dimen6 by \@@HT% \ifdim\dimen4>\dimen6% \def\Myheight{\textheight}\def\Mywidth{}% \else% \def\Mywidth{\textwidth}\def\Myheight{}% \fi and then use height=\Myheight,width=\Mywidth. Bu there's still a problem... Anyway, does it make sense in general? Thomas
On Thu, Sep 11, 2008 at 11:50 PM, Thomas A. Schmitz
On Sep 11, 2008, at 7:59 PM, Thomas A. Schmitz wrote:
On Sep 11, 2008, at 6:20 PM, Thomas A. Schmitz wrote:
\starttext
\start
\setbox\scratchbox\vbox{\externalfigure[mill]}
\dimen0=\wd\scratchbox \dimen2=\ht\scratchbox
\framed[frame=on,strut=no,width=8cm,height=2cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\framed[frame=on,strut=no,width=2cm,height=8cm] {\dimen1=\hsize \divide\dimen1 by \dimen0 \dimen3=\vsize \divide\dimen3 by \dimen2 \ifdim\dimen1>\dimen3 \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi}
\stop
\stoptext
Wolfgang
Wolfgang,
as always, you're a source of wisdom and knowledge... Just I understand this correctly and can adapt it to my macro: \dimen1= \hsize: here \hsize refers to the size of the \framed inside which we're operating, right?
And another question: I get an error "! Illegal unit of measure (pt inserted)." Is it really possible to divide a dimension by another dimension? Not according to what I read here: http://www.tug.org/utilities/plain/cseq.html#divide-rp "must be a nonzero integer." See, I'm far from being a native speaker of TeX...
I now have something along these lines (ugly code ahead!):
\setbox\scratchbox\vbox{\externalfigure[mill]% \dimen0=\wd\scratchbox% \def\@WD{\withoutpt{\the\dimen0}}% \def\@@WD{\integerrounding{\@WD}}% \dimen4=\textwidth \divide\dimen4 by \@@WD% \dimen2=\ht\scratchbox% \def\@HT{\withoutpt{\the\dimen2}}% \def\@@HT{\integerrounding{\@HT}}% \dimen6=\textheight \divide\dimen6 by \@@HT% \ifdim\dimen4>\dimen6% \def\Myheight{\textheight}\def\Mywidth{}% \else% \def\Mywidth{\textwidth}\def\Myheight{}% \fi
and then use height=\Myheight,width=\Mywidth. Bu there's still a problem... Anyway, does it make sense in general?
You should close the box before you want to get it's dimensions. \unprotect \def\????bf{@@@@bf} \presetlocalframed[\????bf] \def\boxfigure[#1][#2]% {\bgroup \setbox\scratchbox\hbox{\externalfigure[#1]}% \!!dimena\wd\scratchbox \!!dimenb\ht\scratchbox \localframed [\????bf] [\c!strut=\v!no, \c!width=8cm, \c!height=6cm, #2] \bgroup \!!dimena\dimexpr\hsize/\!!dimena\relax \!!dimenb\dimexpr\vsize/\!!dimenb\relax \ifdim\!!dimena>\!!dimenb \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi \egroup \egroup} \protect \starttext \boxfigure[mill][width=8cm,height=2cm] \boxfigure[mill][width=2cm,height=8cm] \stoptext Wolfgang
On Sep 12, 2008, at 9:14 AM, Wolfgang Schuster wrote:
You should close the box before you want to get it's dimensions.
:-) That seems like a reasonable suggestion... I had been copy-pasting and adapting my code.
\unprotect
\def\????bf{@@@@bf}
\presetlocalframed[\????bf]
\def\boxfigure[#1][#2]% {\bgroup \setbox\scratchbox\hbox{\externalfigure[#1]}% \!!dimena\wd\scratchbox \!!dimenb\ht\scratchbox \localframed [\????bf] [\c!strut=\v!no, \c!width=8cm, \c!height=6cm, #2] \bgroup \!!dimena\dimexpr\hsize/\!!dimena\relax \!!dimenb\dimexpr\vsize/\!!dimenb\relax \ifdim\!!dimena>\!!dimenb \externalfigure[mill][height=\vsize] \else \externalfigure[mill][width=\hsize] \fi \egroup \egroup}
\protect
\starttext
\boxfigure[mill][width=8cm,height=2cm]
\boxfigure[mill][width=2cm,height=8cm]
\stoptext
Wolfgang
Wow, that looks good! I could adapt this to my circumstances, and it seems to do exactly what I want! Hans: could something like this be added to the core? The keywords "max fit broad" for the "factor" option are already taken, so what about "fill"? But I guess it only makes sense if we can test and adapt to the current vbox (not necessarily the page). Anyway: Wolfgang, thanks a lot, this does exactly what I want! All best Thomas
On Thu, Sep 11, 2008 at 12:06 AM, Thomas A. Schmitz wrote:
Hi guys,
I'm pulling my hair out. I'm trying to set up an automatism to fit pictures to the available space on a slide.
Hello, I'm probably talking about something else, though highly related. There's one thing that I often miss on slides: *Here's a title* - here are - some items [and I want the picture to fill up all the remaining space on slide] Or even if there' only title + image. I tried option=max (or something similar), but always ended up setting image size manually. Most often I got title on one page and image on another (It would be less painful to have image on the same page, even if it hangs much over the lower border - is there something similar to \placefigure[thispage] option (puts the figure on the same page, even if there's no space left)?) Mojca [I need to stop asking questions now.]
On Thu, Sep 11, 2008 at 6:31 PM, Mojca Miklavec
On Thu, Sep 11, 2008 at 12:06 AM, Thomas A. Schmitz wrote:
Hi guys,
I'm pulling my hair out. I'm trying to set up an automatism to fit pictures to the available space on a slide.
Hello,
I'm probably talking about something else, though highly related. There's one thing that I often miss on slides:
*Here's a title*
- here are - some items
[and I want the picture to fill up all the remaining space on slide]
Or even if there' only title + image. I tried option=max (or something similar), but always ended up setting image size manually. Most often I got title on one page and image on another (It would be less painful to have image on the same page, even if it hangs much over the lower border - is there something similar to \placefigure[thispage] option (puts the figure on the same page, even if there's no space left)?)
Mojca
[I need to stop asking questions now.]
Quick and dirty: \showframe \starttext \input knuth \start \scratchdimen=\pagegoal \advance\scratchdimen by -\pagetotal \advance\scratchdimen by -2\lineheight \blank \hrule height \scratchdimen\relax \stop \stoptext Wolfgang
On Fri, Sep 12, 2008 at 12:02 PM, Wolfgang Schuster wrote:
On Thu, Sep 11, 2008 at 6:31 PM, Mojca Miklavec
wrote: On Thu, Sep 11, 2008 at 12:06 AM, Thomas A. Schmitz wrote:
Hi guys,
I'm pulling my hair out. I'm trying to set up an automatism to fit pictures to the available space on a slide.
Hello,
I'm probably talking about something else, though highly related. There's one thing that I often miss on slides:
*Here's a title*
- here are - some items
[and I want the picture to fill up all the remaining space on slide]
Or even if there' only title + image. I tried option=max (or something similar), but always ended up setting image size manually. Most often I got title on one page and image on another (It would be less painful to have image on the same page, even if it hangs much over the lower border - is there something similar to \placefigure[thispage] option (puts the figure on the same page, even if there's no space left)?)
Mojca
[I need to stop asking questions now.]
Quick and dirty:
\showframe
\starttext
\input knuth
\start
\scratchdimen=\pagegoal \advance\scratchdimen by -\pagetotal \advance\scratchdimen by -2\lineheight
\blank
\hrule height \scratchdimen\relax
\stop
\stoptext
Thanks a lot! Two new words for my TeX dictionary (\pagegoal, \pagetotal). Something like this (if packed inside the \placesomething macro) would be great to have in the core as well. I'll clone this code from now on :) Mojca
Mojca Miklavec wrote:
Thanks a lot! Two new words for my TeX dictionary (\pagegoal, \pagetotal). Something like this (if packed inside the \placesomething macro) would be great to have in the core as well.
this is actually what factor=max uses (grep for pagegoal in context/base) hpwever, there is no robust (non intrusive) way to determine the exact page state (so, in case of using pagetotal, keep additional parskips etc in mind) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Hans Hagen
-
Mojca Miklavec
-
Peter Rolf
-
Thomas A. Schmitz
-
Wolfgang Schuster