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
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 -----------------------------------------------------------------
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
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
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
participants (3)
-
Aditya Mahajan
-
Hans Hagen
-
Procházka Lukáš Ing. - Pontex s. r. o.