ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Temporary landscape
@ 2010-10-13 13:22 Procházka Lukáš Ing. - Pontex s. r. o.
  2010-10-13 13:50 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2010-10-13 13:22 UTC (permalink / raw)
  To: ConTeXt

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]

Hello,

I need to typeset contents of a wide file. This works:

---
\starttext

   \setuppapersize[A4,landscape][A4,landscape]
   \typefile[Dim]{Cha-MMax-iDL.txt}

   \page

   % RESTORE ORIGINAL PAGE SETTINGS

   AAA

\stoptext
---

And I'd like to find out how to restore previous page settings.

I guess I could call something like "\setuppapersize[A4][A4]" at the place of "RESTORE ORIGINAL PAGE SETTINGS", but I'd rather something independent (now I'd have to suppose that previous page is of A4 format).

I'm thinking about like enclosing the

   \setuppapersize[A4,landscape][A4,landscape]
   \typefile[Dim]{../../Statics/Dim/Res/Cha-MMax-iDL.txt}

into an environment or something.

Maybe something like \setupenvironment[MyEnv][...] in the preamble and later

   \startenvironment[MyEnv]
     \setuppapersize[A4,landscape][A4,landscape]
     \typefile[Dim]{../../Statics/Dim/Res/Cha-MMax-iDL.txt}
   \stopenvironment

Is there something like that? (Wiki: http://wiki.contextgarden.net/Reference/en/startenvironment is a bit empty.)

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

[-- Attachment #2: Cha-MMax-iDL.txt --]
[-- Type: text/plain, Size: 3915 bytes --]

;---------------------------------------------------------------------------------------------+
; Ponton (R) "B" - Beam v1.3d/2010-10-13, (C) 2002-2010 Ing. Lukas Prochazka, Pontex s. r. o. |
;---------------------------------------------------------------------------------------------+
;
;     Sec.Name  P.     LC.Name  Cat.       N  Mx.Cen  My.Cen   Con.A  Con.Sig- C.Sg-.Per      Re.A    Ar/A   Re.Sig+ R.Sg+.Per  M. Flags     Use
;-----------------------------------------------------------------------------------------------------------------------------------------------
      0000.000   1    Cha-MMax     1       0       0       0   8.947         0   -18.000         0  0.000%         0   400.000   1  0000       ?
      0000.325   1    Cha-MMax     1 -0.0003  0.0159       0   8.947 -0.060590   -18.000  0.051472  0.575%     3.239   400.000   1  ....  0.810%
      0000.650   1    Cha-MMax     1 -0.0005  0.0636       0   8.947 -0.242535   -18.000  0.051472  0.575%    13.000   400.000   1  ....   3.25%
      0001.350   1    Cha-MMax     1  0.0231  -2.081       0   8.947    -3.911   -18.000  0.051472  0.575%    66.217   400.000   1  ....   21.7%
      0002.050   1    Cha-MMax     1  0.0086  -4.221       0   8.947    -7.934   -18.000  0.051472  0.575%   133.961   400.000   1  ....   44.1%
      0002.750   1    Cha-MMax     1  0.0080  -5.799       0   8.947   -10.899   -18.000  0.051472  0.575%   183.979   400.000   1  ....   60.6%
      0003.450   1    Cha-MMax     1  0.0074  -7.376       0   8.947   -13.864   -18.000  0.051472  0.575%   233.997   400.000   1  ....   77.0%
      0004.150   1    Cha-MMax     1  0.0069  -8.358       0   8.947   -15.709   -18.000  0.051472  0.575%   265.119   400.000   1  ....   87.3%
      0004.850   1    Cha-MMax     1  0.0063  -9.339       0   8.947   -17.554   -18.000  0.051472  0.575%   296.241   400.000   1  ....   97.5%
      0005.550   1    Cha-MMax     1  0.0057  -9.638       0   8.947   -18.115   -18.000  0.051472  0.575%   305.712   400.000   1  .C..  100.6%
      0006.250   1    Cha-MMax     1  0.0051  -9.937       0   8.947   -18.677   -18.000  0.051472  0.575%   315.183   400.000   1  .C..  103.8%
      0006.950   1    Cha-MMax     1  0.0046  -9.616       0   8.947   -18.074   -18.000  0.051472  0.575%   305.003   400.000   1  .C..  100.4%
      0007.650   1    Cha-MMax     1  0.0040  -9.295       0   8.947   -17.471   -18.000  0.051472  0.575%   294.823   400.000   1  ....   97.1%
      0008.350   1    Cha-MMax     1  0.0034  -8.368       0   8.947   -15.729   -18.000  0.051472  0.575%   265.420   400.000   1  ....   87.4%
      0009.050   1    Cha-MMax     1  0.0028  -7.441       0   8.947   -13.986   -18.000  0.051472  0.575%   236.017   400.000   1  ....   77.7%
      0009.750   1    Cha-MMax     1  0.0023  -5.861       0   8.947   -11.017   -18.000  0.051472  0.575%   185.903   400.000   1  ....   61.2%
      0010.450   1    Cha-MMax     1  0.0017  -4.281       0   8.947    -8.047   -18.000  0.051472  0.575%   135.788   400.000   1  ....   44.7%
      0011.150   1    Cha-MMax     1  0.0011  -2.109       0   8.947    -3.964   -18.000  0.051472  0.575%    66.888   400.000   1  ....   22.0%
      0011.850   1    Cha-MMax     1  0.0005  0.0636       0   8.947 -0.243019   -18.000  0.051472  0.575%    13.089   400.000   1  ....   3.27%
      0012.175   1    Cha-MMax     1  0.0003  0.0159       0   8.947 -0.060832   -18.000  0.051472  0.575%     3.283   400.000   1  ....  0.821%
      0012.500   1    Cha-MMax     1       0       0       0   8.947         0   -18.000         0  0.000%         0   400.000   1  0000       ?
;-----------------------------------------------------------------------------------------------------------------------------------------------
;                1    Cha-MMax     ?       ?       ?       ?       ?   -18.677         ?         ?       ?   315.183         ?   0  ....  103.8%

[-- Attachment #3: Type: text/plain, Size: 486 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] 4+ messages in thread

* Re: Temporary landscape
  2010-10-13 13:22 Temporary landscape Procházka Lukáš Ing. - Pontex s. r. o.
@ 2010-10-13 13:50 ` Hans Hagen
  2010-10-13 14:03   ` Aditya Mahajan
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2010-10-13 13:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 13-10-2010 3:22, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> Hello,
>
> I need to typeset contents of a wide file. This works:
>
> ---
> \starttext
>
> \setuppapersize[A4,landscape][A4,landscape]
> \typefile[Dim]{Cha-MMax-iDL.txt}
>
> \page
>
> % RESTORE ORIGINAL PAGE SETTINGS
>
> AAA
>
> \stoptext

You can wikify this:

\setuplayout
   [location=middle]

\showframe

\def\PushPaperSize
   {\edef\PopPaperSize{\setuppapersize[\papersize][\printpapersize]}}

\starttext
     \setuppapersize[A4][A3]
     test \page
     \PushPaperSize
     \setuppapersize[A4,landscape][A3,landscape]
     test \page
     \PopPaperSize
     test \page
\stoptext


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

* Re: Temporary landscape
  2010-10-13 13:50 ` Hans Hagen
@ 2010-10-13 14:03   ` Aditya Mahajan
  2010-10-13 15:12     ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2010-10-13 14:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2535 bytes --]

On Wed, 13 Oct 2010, Hans Hagen wrote:

> On 13-10-2010 3:22, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
>> Hello,
>> 
>> I need to typeset contents of a wide file. This works:
>> 
>> ---
>> \starttext
>> 
>> \setuppapersize[A4,landscape][A4,landscape]
>> \typefile[Dim]{Cha-MMax-iDL.txt}
>> 
>> \page
>> 
>> % RESTORE ORIGINAL PAGE SETTINGS
>> 
>> AAA
>> 
>> \stoptext
>
> You can wikify this:
>
> \setuplayout
>  [location=middle]
>
> \showframe
>
> \def\PushPaperSize
>  {\edef\PopPaperSize{\setuppapersize[\papersize][\printpapersize]}}
>
> \starttext
>    \setuppapersize[A4][A3]
>    test \page
>    \PushPaperSize
>    \setuppapersize[A4,landscape][A3,landscape]
>    test \page
>    \PopPaperSize
>    test \page
> \stoptext

From my to be completed TUGboat article:

\section {Changing paper size within a document}

To get one page (containing a table or a figure) in landscape
mode, you can use \type{\adaptpapersize}. For example,

\starttyping
\definepapersize[main] [A4] [A4]
\definepapersize[extra][A4,landscape]
                        [A4,landscape]

\setuppapersize[main]
\starttext
     Page 1. Potrait \page
     Page 2. Potrait \page
     \adaptpapersize[extra]
     Page 3. Landscape \page
     Page 4. Potrait \page
\stoptext
\stoptyping

If you have a full page figure that you want to include in a landscape 
paper, you can combine \type{\adaptpapersize} with \CONTEXT's postponing 
mechanism.

\starttyping
   \startpostponing
     \adaptpapersize[extra]
     \placefigure
       [here]
       [fig:reference]
       {The caption of the figure}
       {\extrenalgraphics[full-page-figure]}
     \page
   \stoppostponing
\stoptyping

The \type{postponing} environment postpones the figure until the next 
page. When the new page starts, \type{\adaptpapersize} changes to 
landscape mode. The \type{\page} is the end is to make sure even if some 
place is remaining on the page, we do not get any text there.

To get more than one page in landscape, you can reuse 
\type{\setuppapersize}.
For example,

\starttyping
\definepapersize[main] [A4] [A4]
\definepapersize[extra][A4,landscape]
                        [A4,landscape]

\setuppapersize[main]
\starttext
     Page 1. Potrait \page
     Page 2. Potrait \page
\setuppapersize[extra]
     Page 3. Landscape \page
     Page 4. Landscape \page
\setuppapersize[main]
     Page 5. Potrait \page
     Page 6. Potrait \page
\stoptext
\stoptyping


Aditya

[-- Attachment #2: Type: text/plain, Size: 486 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] 4+ messages in thread

* Re: Temporary landscape
  2010-10-13 14:03   ` Aditya Mahajan
@ 2010-10-13 15:12     ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 0 replies; 4+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2010-10-13 15:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you both for the suggestions. My final code looks like this:

---
\def\PushPaperSize{\edef\PopPaperSize{\setuppapersize[\papersize][\printpapersize]}}

\definehead[subjectLand][subject]
\setuphead[subjectLand][before={\PushPaperSize\page},style=bold]

\setuptyping[Dim][bodyfont=small,style={\ttx\setupinterlinespace}]

\starttext

   \def\T#1#2{
     \subjectLand{#1}
     \setuppapersize[A4,landscape][A4,landscape]
     \typefile[Dim]{../../Statics/Dim/Res/#2.txt}
     \typefile[Dim]{../../Statics/Dim/Res/#2.txt} % Just to test (=> more than one page)
     \typefile[Dim]{../../Statics/Dim/Res/#2.txt} % Just to test (=> more than one page)
     \page
     \PopPaperSize
   }

   \T{A}{ULS-MMax-iDL}

   \T{B}{ULS-MMax-iDL}
   \T{C}{ULS-MMax-iDL}
   \T{D}{ULS-MMax-iDL}

   AAA

\stoptext

---

I'd have one more question about page layout - let's have the following code:

---
\showframe

\starttext
   AAA
   \page
   \setuppapersize[A4,landscape][A4,landscape]
   BBB
   \page
   \setuppapersize[A4,landscape][A4,landscape]
   \setuplayout[topspace=3in] % How to change text height to keep the bottom print range?
   CCC
\stoptext
---

In this example, I changed the topsize by 2in, i.e. 3in (new value) - 1in (default = previous value). And I want to shorten the textheight by the same difference, i.e. by 2in (i.e. to keep the bottom range of print space).

I know that I can set textheight directly - but I don't want to do so, I want this value to be computed from the change of the topsize. Is it possible somehow?

Moreover, would it be possible by Lua code? Something like this (pseudo)code:

---
\startluacode
   local ts, th = context.topspace, context.textheight
   local dif = 72 -- 72bp = 1in
                  -- Or to call a conversion routine, e.g. in2bp(1), if it exists?

   ts = ts + dif
   th = th - dif

   context(string.format("\\setuplayout[topspace=%i,textheight=%i]", ts, th))

   -- or: context.setuplayout{topspace=ts, textheight=th}
\stopluacode
---

Best regards,

Lukas


On Wed, 13 Oct 2010 16:03:33 +0200, Aditya Mahajan <adityam@umich.edu> wrote:

> On Wed, 13 Oct 2010, Hans Hagen wrote:
>
>> On 13-10-2010 3:22, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
>>> Hello,
>>>
>>> I need to typeset contents of a wide file. This works:
>>>
>>> ---
>>> \starttext
>>>
>>> \setuppapersize[A4,landscape][A4,landscape]
>>> \typefile[Dim]{Cha-MMax-iDL.txt}
>>>
>>> \page
>>>
>>> % RESTORE ORIGINAL PAGE SETTINGS
>>>
>>> AAA
>>>
>>> \stoptext
>>
>> You can wikify this:
>>
>> \setuplayout
>>  [location=middle]
>>
>> \showframe
>>
>> \def\PushPaperSize
>>  {\edef\PopPaperSize{\setuppapersize[\papersize][\printpapersize]}}
>>
>> \starttext
>>    \setuppapersize[A4][A3]
>>    test \page
>>    \PushPaperSize
>>    \setuppapersize[A4,landscape][A3,landscape]
>>    test \page
>>    \PopPaperSize
>>    test \page
>> \stoptext
>
> From my to be completed TUGboat article:
>
> \section {Changing paper size within a document}
>
> To get one page (containing a table or a figure) in landscape
> mode, you can use \type{\adaptpapersize}. For example,
>
> \starttyping
> \definepapersize[main] [A4] [A4]
> \definepapersize[extra][A4,landscape]
>                         [A4,landscape]
>
> \setuppapersize[main]
> \starttext
>      Page 1. Potrait \page
>      Page 2. Potrait \page
>      \adaptpapersize[extra]
>      Page 3. Landscape \page
>      Page 4. Potrait \page
> \stoptext
> \stoptyping
>
> If you have a full page figure that you want to include in a landscape
> paper, you can combine \type{\adaptpapersize} with \CONTEXT's postponing
> mechanism.
>
> \starttyping
>    \startpostponing
>      \adaptpapersize[extra]
>      \placefigure
>        [here]
>        [fig:reference]
>        {The caption of the figure}
>        {\extrenalgraphics[full-page-figure]}
>      \page
>    \stoppostponing
> \stoptyping
>
> The \type{postponing} environment postpones the figure until the next
> page. When the new page starts, \type{\adaptpapersize} changes to
> landscape mode. The \type{\page} is the end is to make sure even if some
> place is remaining on the page, we do not get any text there.
>
> To get more than one page in landscape, you can reuse
> \type{\setuppapersize}.
> For example,
>
> \starttyping
> \definepapersize[main] [A4] [A4]
> \definepapersize[extra][A4,landscape]
>                         [A4,landscape]
>
> \setuppapersize[main]
> \starttext
>      Page 1. Potrait \page
>      Page 2. Potrait \page
> \setuppapersize[extra]
>      Page 3. Landscape \page
>      Page 4. Landscape \page
> \setuppapersize[main]
>      Page 5. Potrait \page
>      Page 6. Potrait \page
> \stoptext
> \stoptyping
>
>
> Aditya

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

end of thread, other threads:[~2010-10-13 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-13 13:22 Temporary landscape Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-13 13:50 ` Hans Hagen
2010-10-13 14:03   ` Aditya Mahajan
2010-10-13 15:12     ` Procházka Lukáš Ing. - Pontex s. r. o.

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