ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* fit text to page
@ 2012-07-27 17:01 Reviczky Adam
  2012-07-28 11:56 ` Jan Kula
  2012-07-28 12:03 ` Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: Reviczky Adam @ 2012-07-27 17:01 UTC (permalink / raw)
  To: ntg-context

Hi list,

I'm trying to scale a text to the textwidth and textheight by keeping
the aspect ratio, using different papersizes.
When the dimensions get too big I get an "Arithmetic overflow".
(I'm trying to do something similar to resizebox in LaTeX:
http://tex.stackexchange.com/questions/55394/perfectly-scale-line-paragraph-image-anything-up-to-textwidth)

Minimal example:
\setuppapersize[A4][A4] %% [A1][A1]
\showframe
\starttext
\scale[factor=max,width=\textwidth,height=\textheight]{\framed[frame=on]{!}}
\stoptext

Error message:
! Arithmetic overflow.
<recently read> \c_grph_scale_used_y_scale

\grph_scale_convert_large_scale ...scratchdimen #3
                                                  \relax \fi \scratchdimen -...
\grph_scale_calculations_yes ...grph_scale_temp_y
                                                  \xdef \finalscaleboxwidth ...
\grph_scale_calculate ...h_scale_calculations_yes
                                                  \fi \fi \fi
\syst_boxes_with_next_box ...grph_scale_calculate
                                                  \ifconditional \c_grph_sca...
l.6 ...h,height=\textheight]{\framed[frame=on]{!}}


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

* Re: fit text to page
  2012-07-27 17:01 fit text to page Reviczky Adam
@ 2012-07-28 11:56 ` Jan Kula
  2012-07-28 12:03 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kula @ 2012-07-28 11:56 UTC (permalink / raw)
  To: ntg-context

Hallo Adam,

On 07/27/2012 07:01 PM, Reviczky Adam wrote:
> Hi list,
>
> I'm trying to scale a text to the textwidth and textheight by keeping
> the aspect ratio, using different papersizes.
> When the dimensions get too big I get an "Arithmetic overflow".
> (I'm trying to do something similar to resizebox in LaTeX:
> http://tex.stackexchange.com/questions/55394/perfectly-scale-line-paragraph-image-anything-up-to-textwidth)
>
> Minimal example:
> \setuppapersize[A4][A4] %% [A1][A1]
> \showframe
> \starttext
> \scale[factor=max,width=\textwidth,height=\textheight]{\framed[frame=on]{!}}
> \stoptext
>
> Error message:
> ! Arithmetic overflow.
> <recently read>  \c_grph_scale_used_y_scale
>
> \grph_scale_convert_large_scale ...scratchdimen #3
>                                                    \relax \fi \scratchdimen -...
> \grph_scale_calculations_yes ...grph_scale_temp_y
>                                                    \xdef \finalscaleboxwidth ...
> \grph_scale_calculate ...h_scale_calculations_yes
>                                                    \fi \fi \fi
> \syst_boxes_with_next_box ...grph_scale_calculate
>                                                    \ifconditional \c_grph_sca...
> l.6 ...h,height=\textheight]{\framed[frame=on]{!}}
>
>
> Adam

Not sure where exactly, but likely you have reached a size calculation 
limit of TeX (seems like a box calculation since more text works fine). 
Start with the bigger font size if you want to enlarge the box that much:

\setuppapersize[A4][A4] %% [A1][A1]
\showframe
\starttext
\definedfont[Serif at 20pt]
\scale[factor=max,width=\textwidth,height=\textheight]{\framed[frame=on]{!}}
\stoptext

Jano

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

* Re: fit text to page
  2012-07-27 17:01 fit text to page Reviczky Adam
  2012-07-28 11:56 ` Jan Kula
@ 2012-07-28 12:03 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2012-07-28 12:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Reviczky Adam

On 27-7-2012 19:01, Reviczky Adam wrote:
> setuppapersize[A4][A4] %% [A1][A1]
> \showframe
> \starttext
> \scale[factor=max,width=\textwidth,height=\textheight]{\framed[frame=on]{!}}
> \stoptext

you can experiment with

\unprotect

\def\grph_scale_convert_large_scale#1#2#3#4%
 
{\edef#2{\ifnum#3=\plusthousand-\the\dimexpr#1\else\luaexpr{-\number#3*\number\dimexpr#1/1000}sp\fi}%
    \edef#4{\luaexpr{\number#3/10}}}

\protect

at the top of your file

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

end of thread, other threads:[~2012-07-28 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-27 17:01 fit text to page Reviczky Adam
2012-07-28 11:56 ` Jan Kula
2012-07-28 12:03 ` Hans Hagen

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