Restoring/switching paper size?
Hello, why this code doesn't restore A4-portrait for page 3? ---- \showframe \starttext Page 1 \page \adaptpapersize[A4,landscape] Page 2 \page Page 3 \stoptext ---- (I need to mix A4 portrait/landscape pages in a document...) When I need to switch to landscape for more pages (e.g. for long large tables; \adaptpapersize is not enough as it changes just one current page), is there something like: \pushpapersize \page \setuppapersize[A4,landscape] ... more pages ... \poppapersize Best regards, 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 241 096 751 (+420 720 951 172) Fax: +420 244 461 038
This is a bug. The following example from the wiki (http://wiki.contextgarden.net/PaperSetup) does not work either. At least not with ConTeXt MkIV in TL2016. \showframe \definepapersize[main] [A4] \definepapersize[extra][A4,landscape] \setuppapersize[main] \starttext Page 1. Portrait \page Page 2. Portrait \page \adaptpapersize[extra] Page 3. Landscape \page Page 4. Portrait \page \stoptext On 07/18/2016 03:09 PM, Procházka Lukáš Ing. wrote:
\showframe
\starttext Page 1 \page \adaptpapersize[A4,landscape] Page 2 \page Page 3 \stoptext
On 7/18/2016 3:27 PM, Henri Menke wrote:
This is a bug. The following example from the wiki (http://wiki.contextgarden.net/PaperSetup) does not work either. At least not with ConTeXt MkIV in TL2016.
\showframe
\definepapersize[main] [A4] \definepapersize[extra][A4,landscape]
\setuppapersize[main]
\starttext Page 1. Portrait \page Page 2. Portrait \page \adaptpapersize[extra] Page 3. Landscape \page Page 4. Portrait \page \stoptext
On 07/18/2016 03:09 PM, Procházka Lukáš Ing. wrote:
\showframe
\starttext Page 1 \page \adaptpapersize[A4,landscape] Page 2 \page Page 3 \stoptext
It's not so much a bug but more something undefined as \definepapersize[main] [A4] [A4] \definepapersize[extra][A4,landscape][A4,landscape] works ok. I'll add a default third argument but the above works well too. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 07/18/2016 03:27 PM, Henri Menke wrote:
This is a bug. The following example from the wiki (http://wiki.contextgarden.net/PaperSetup) does not work either. At least not with ConTeXt MkIV in TL2016.
Hi Lukáš and Henri, this seems to work with latest beta: \showframe \definepapersize[main] [A4][A4] \definepapersize[extra][A4,landscape][A4,landscape] \setuppapersize[main] \starttext Page 1. Portrait \page Page 2. Portrait \page \setuppapersize[extra] Page 3. Landscape \page \setuppapersize[main] Page 4. Portrait \page \stoptext I hope it helps, Pablo -- http://www.ousia.tk
Procházka Lukáš Ing. mailto:LPr@pontex.cz 18. Juli 2016 um 15:09 Hello,
why this code doesn't restore A4-portrait for page 3?
---- \showframe
\starttext Page 1 \page \adaptpapersize[A4,landscape] Page 2 \page Page 3 \stoptext ---- page-lay.mkiv
\unexpanded\def\adaptpapersize - {\global\let\page_paper_reinstate\page_paper_reinstate_indeed + {\global\let\page_paper_reinstate\page_paper_restore \setuppapersize} -\unexpanded\def\page_paper_reinstate_indeed - {\page_paper_reinstate - \global\let\page_paper_reinstate\relax} \appendtoks \page_paper_reinstate + \global\let\page_paper_reinstate\relax \to \everyaftershipout
(I need to mix A4 portrait/landscape pages in a document...)
When I need to switch to landscape for more pages (e.g. for long large tables; \adaptpapersize is not enough as it changes just one current page), is there something like:
\pushpapersize \page \setuppapersize[A4,landscape] ... more pages ... \poppapersize There is no start/stop version like we have for layouts (\startlayout[...] ... \stoplayout) but you can use named sizes.
\definepapersize [main] [A4] [A4] \definepapersize [extra] [A4,landscape] [A4,landscape] \starttext Page 1. \page Page 2. \page \setuppapersize[extra] Page 3. \page Page 4. \page \setuppapersize[main] Page 5. \page Page 6. \page \stoptext Wolfgang
Hello,
thank you for the patch.
A solution which would not require named page sizes might be better as we don't necessary need to know the name of the "previous" (or "pushed") paper size (mostly we use "anonymous" page sizes, set up once in the document preamble).
Thus push/pop way would be a bit more flexible (like \pushpagebackground / \poppagebackground);
or making paper size local (enclosing paper setup into group - \start \setupppapersize ... \stop\page) would restore the previous paper size.
Thank you anyway.
Best regards
Lukas
On Mon, 18 Jul 2016 16:00:05 +0200, Wolfgang Schuster
Procházka Lukáš Ing. mailto:LPr@pontex.cz 18. Juli 2016 um 15:09 Hello,
why this code doesn't restore A4-portrait for page 3?
---- \showframe
\starttext Page 1 \page \adaptpapersize[A4,landscape] Page 2 \page Page 3 \stoptext ---- page-lay.mkiv
\unexpanded\def\adaptpapersize - {\global\let\page_paper_reinstate\page_paper_reinstate_indeed + {\global\let\page_paper_reinstate\page_paper_restore \setuppapersize}
-\unexpanded\def\page_paper_reinstate_indeed - {\page_paper_reinstate - \global\let\page_paper_reinstate\relax}
\appendtoks \page_paper_reinstate + \global\let\page_paper_reinstate\relax \to \everyaftershipout
(I need to mix A4 portrait/landscape pages in a document...)
When I need to switch to landscape for more pages (e.g. for long large tables; \adaptpapersize is not enough as it changes just one current page), is there something like:
\pushpapersize \page \setuppapersize[A4,landscape] ... more pages ... \poppapersize There is no start/stop version like we have for layouts (\startlayout[...] ... \stoplayout) but you can use named sizes.
\definepapersize [main] [A4] [A4] \definepapersize [extra] [A4,landscape] [A4,landscape]
\starttext Page 1. \page Page 2. \page \setuppapersize[extra] Page 3. \page Page 4. \page \setuppapersize[main] Page 5. \page Page 6. \page \stoptext
Wolfgang
-- 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 241 096 751 (+420 720 951 172) Fax: +420 244 461 038
Hello,
one more problem - paper height still 297 mm?
----
\definepapersize[A4L][A4,landscape]
\showframe
\starttext
\setuppapersize[A4L]
A4L
\stoptext
----
(Ctx already patched by WS' solution.)
Best regards,
Lukas
On Mon, 18 Jul 2016 16:41:06 +0200, Procházka Lukáš Ing.
Hello,
thank you for the patch.
A solution which would not require named page sizes might be better as we don't necessary need to know the name of the "previous" (or "pushed") paper size (mostly we use "anonymous" page sizes, set up once in the document preamble).
Thus push/pop way would be a bit more flexible (like \pushpagebackground / \poppagebackground); or making paper size local (enclosing paper setup into group - \start \setupppapersize ... \stop\page) would restore the previous paper size.
Thank you anyway.
Best regards
Lukas
On Mon, 18 Jul 2016 16:00:05 +0200, Wolfgang Schuster
wrote: Procházka Lukáš Ing. mailto:LPr@pontex.cz 18. Juli 2016 um 15:09 Hello,
why this code doesn't restore A4-portrait for page 3?
---- \showframe
\starttext Page 1 \page \adaptpapersize[A4,landscape] Page 2 \page Page 3 \stoptext ---- page-lay.mkiv
\unexpanded\def\adaptpapersize - {\global\let\page_paper_reinstate\page_paper_reinstate_indeed + {\global\let\page_paper_reinstate\page_paper_restore \setuppapersize}
-\unexpanded\def\page_paper_reinstate_indeed - {\page_paper_reinstate - \global\let\page_paper_reinstate\relax}
\appendtoks \page_paper_reinstate + \global\let\page_paper_reinstate\relax \to \everyaftershipout
(I need to mix A4 portrait/landscape pages in a document...)
When I need to switch to landscape for more pages (e.g. for long large tables; \adaptpapersize is not enough as it changes just one current page), is there something like:
\pushpapersize \page \setuppapersize[A4,landscape] ... more pages ... \poppapersize There is no start/stop version like we have for layouts (\startlayout[...] ... \stoplayout) but you can use named sizes.
\definepapersize [main] [A4] [A4] \definepapersize [extra] [A4,landscape] [A4,landscape]
\starttext Page 1. \page Page 2. \page \setuppapersize[extra] Page 3. \page Page 4. \page \setuppapersize[main] Page 5. \page Page 6. \page \stoptext
Wolfgang
-- 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 241 096 751 (+420 720 951 172) Fax: +420 244 461 038
Procházka Lukáš Ing. mailto:LPr@pontex.cz 18. Juli 2016 um 16:59 Hello,
one more problem - paper height still 297 mm?
---- \definepapersize[A4L][A4,landscape]
\showframe
\starttext \setuppapersize[A4L] A4L \stoptext ---- Look at Hans answer, you need at the moment a third argument for the \definepapersize but he's going to allow two as well.
Wolfgang
Hello,
one more problem - paper height still 297 mm?
----
\definepapersize[A4L][A4,landscape]
\showframe
\starttext
\setuppapersize[A4L]
A4L
\stoptext
----
(Ctx already patched by WS' solution.)
Best regards,
Lukas
On Mon, 18 Jul 2016 16:41:06 +0200, Procházka Lukáš Ing.
Hello,
thank you for the patch.
A solution which would not require named page sizes might be better as we don't necessary need to know the name of the "previous" (or "pushed") paper size (mostly we use "anonymous" page sizes, set up once in the document preamble).
Thus push/pop way would be a bit more flexible (like \pushpagebackground / \poppagebackground); or making paper size local (enclosing paper setup into group - \start \setupppapersize ... \stop\page) would restore the previous paper size.
Thank you anyway.
Best regards
Lukas
On Mon, 18 Jul 2016 16:00:05 +0200, Wolfgang Schuster
wrote: Procházka Lukáš Ing. mailto:LPr@pontex.cz 18. Juli 2016 um 15:09 Hello,
why this code doesn't restore A4-portrait for page 3?
---- \showframe
\starttext Page 1 \page \adaptpapersize[A4,landscape] Page 2 \page Page 3 \stoptext ---- page-lay.mkiv
\unexpanded\def\adaptpapersize - {\global\let\page_paper_reinstate\page_paper_reinstate_indeed + {\global\let\page_paper_reinstate\page_paper_restore \setuppapersize}
-\unexpanded\def\page_paper_reinstate_indeed - {\page_paper_reinstate - \global\let\page_paper_reinstate\relax}
\appendtoks \page_paper_reinstate + \global\let\page_paper_reinstate\relax \to \everyaftershipout
(I need to mix A4 portrait/landscape pages in a document...)
When I need to switch to landscape for more pages (e.g. for long large tables; \adaptpapersize is not enough as it changes just one current page), is there something like:
\pushpapersize \page \setuppapersize[A4,landscape] ... more pages ... \poppapersize There is no start/stop version like we have for layouts (\startlayout[...] ... \stoplayout) but you can use named sizes.
\definepapersize [main] [A4] [A4] \definepapersize [extra] [A4,landscape] [A4,landscape]
\starttext Page 1. \page Page 2. \page \setuppapersize[extra] Page 3. \page Page 4. \page \setuppapersize[main] Page 5. \page Page 6. \page \stoptext
Wolfgang
-- 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 241 096 751 (+420 720 951 172) Fax: +420 244 461 038
Procházka Lukáš Ing. mailto:LPr@pontex.cz 18. Juli 2016 um 16:41 Hello,
thank you for the patch.
A solution which would not require named page sizes might be better as we don't necessary need to know the name of the "previous" (or "pushed") paper size (mostly we use "anonymous" page sizes, set up once in the document preamble).
Thus push/pop way would be a bit more flexible (like \pushpagebackground / \poppagebackground); or making paper size local (enclosing paper setup into group - \start \setupppapersize ... \stop\page) would restore the previous paper size. A normal environment should be enough (push and pop are used to save and restore states etc.) which inserts are the necessary page breaks.
\unprotect \def\startpapersize {\page \pushmacro\page_paper_restore \setuppapersize} \def\stoppapersize {\page \popmacro\page_paper_restore \setuppapersize} \protect \starttext Page 1. \page Page 2. \page \startpapersize[A4,landscape] Page 3. \page Page 4. \page \stoppapersize Page 5. \page Page 6. \page \stoptext Wolfgang
Great, thank you! Lukas
On Mon, 18 Jul 2016 17:12:04 +0200, Wolfgang Schuster
A normal environment should be enough (push and pop are used to save and restore states etc.) which inserts are the necessary page breaks.
\unprotect
\def\startpapersize {\page \pushmacro\page_paper_restore \setuppapersize}
\def\stoppapersize {\page \popmacro\page_paper_restore \setuppapersize}
\protect
\starttext Page 1. \page Page 2. \page \startpapersize[A4,landscape] Page 3. \page Page 4. \page \stoppapersize Page 5. \page Page 6. \page \stoptext
Wolfgang
-- 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 241 096 751 (+420 720 951 172) Fax: +420 244 461 038
participants (5)
-
Hans Hagen
-
Henri Menke
-
Pablo Rodriguez
-
Procházka Lukáš Ing.
-
Wolfgang Schuster