[NTG-context] Temporary landscape

Procházka Lukáš Ing. - Pontex s. r. o. LPr at pontex.cz
Wed Oct 13 17:12:08 CEST 2010


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 at 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



More information about the ntg-context mailing list