Hello, here comes a feature request: Could ConTeXt add to the dvi-file information about paper-size, so that one does not need the -t option of dvips? This is done in LaTeX (+hyperref) by using something like \special{papersize=...} but I didn't get it working in ConTeXt... TIA for any help! Cheers, Peter -- http://pmrb.free.fr/contact/
Hello, Peter Münster wrote:
here comes a feature request:
Could ConTeXt add to the dvi-file information about paper-size, so that one does not need the -t option of dvips?
This is done in LaTeX (+hyperref) by using something like \special{papersize=...} but I didn't get it working in ConTeXt...
Should be e.g. for "A4" \special{papersize=210mm,297mm} and for "A5" \special{papersize=148mm,210mm}. If I add this, it actually seems to work here. I failed to create something which obtains the papersize automatically. Tobias
On Fri, 27 May 2005, Tobias Burnus wrote:
Should be e.g. for "A4" \special{papersize=210mm,297mm} and for "A5" \special{papersize=148mm,210mm}. If I add this, it actually seems to work here. I failed to create something which obtains the papersize automatically.
Yes, that's the problem. I tried \special{papersize=\paperwidth,\paperheight} and \special{papersize=\PtToCm{\paperwidth},\PtToCm{\paperheight}} Perhaps we need a \PtToMm{...} ? Cheers, Peter -- http://pmrb.free.fr/contact/
Hello, Peter Münster wrote:
On Fri, 27 May 2005, Tobias Burnus wrote:
Should be e.g. for "A4" \special{papersize=210mm,297mm} and for "A5" \special{papersize=148mm,210mm}. If I add this, it actually seems to work here. I failed to create something which obtains the papersize automatically.
Ok, the following works: \special{papersize=\the\paperwidth,\the\paperheight}
It puts (for \setuppapersize[letter][letter]) the following into the DVI file (dvips -d3 test2.dvi 2>&1 |grep special): papersize=614.295pt,794.96999pt which gv shows as letter. Having the right unit (as defined in page-lay.tex, i.e. 148mm×210mm for A5, 8.5in×11in for letter etc.) would be probably better, but this works.
Yes, that's the problem. I tried \special{papersize=\paperwidth,\paperheight}
That expands to: papersize=\paperwidth ,\paperheight which dvips cannot digest.
and \special{papersize=\PtToCm{\paperwidth},\PtToCm{\paperheight}}
Whereas that expands to
papersize=\begingroup \scratchdimen \paperwidth \relax \scratchdimen
0.0351459804\scratchdimen 0.0cm\endgroup ,\begingroup \scratchdimen
\paperheight \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup
\PtToCm contains assignments, so it won't expand. Here is a macro that does basically the same, but in a different order. \def\writepapersize{% \begingroup \dimen0 0.0351459804\paperwidth % 2.54/72.27 \dimen1 0.0351459804\paperheight \special {papersize={\withoutpt\the\dimen0 cm,\withoutpt\the\dimen1 cm}% \endgroup } Taco Tobias Burnus wrote:
Hello,
Peter Münster wrote:
On Fri, 27 May 2005, Tobias Burnus wrote:
Should be e.g. for "A4" \special{papersize=210mm,297mm} and for "A5" \special{papersize=148mm,210mm}. If I add this, it actually seems to work here. I failed to create something which obtains the papersize automatically.
Ok, the following works: \special{papersize=\the\paperwidth,\the\paperheight}
It puts (for \setuppapersize[letter][letter]) the following into the DVI file (dvips -d3 test2.dvi 2>&1 |grep special): papersize=614.295pt,794.96999pt which gv shows as letter. Having the right unit (as defined in page-lay.tex, i.e. 148mm×210mm for A5, 8.5in×11in for letter etc.) would be probably better, but this works.
Yes, that's the problem. I tried \special{papersize=\paperwidth,\paperheight}
That expands to: papersize=\paperwidth ,\paperheight which dvips cannot digest.
and \special{papersize=\PtToCm{\paperwidth},\PtToCm{\paperheight}}
Whereas that expands to
papersize=\begingroup \scratchdimen \paperwidth \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup ,\begingroup \scratchdimen \paperheight \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup
[1Processing special: papersize=\begingroup \scratchdimen \paperwidth \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup ,\begingroup \scratchdimen \paperheight \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup still something dvips cannot digest.
I have to admit, I actually fail to expand \special{papersize=\PtToCm{\the\paperwidth},\PtToCm{\the\paperheight}} correctly. It always ends up as \begingroup ... in the DVI file (i.e. as above with \paperheight|weight replaced by its numerical value).
Tobias
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Taco Hoekwater wrote:
\PtToCm contains assignments, so it won't expand. Here is a macro that does basically the same, but in a different order.
\def\writepapersize{% \begingroup \dimen0 0.0351459804\paperwidth % 2.54/72.27 \dimen1 0.0351459804\paperheight \special {papersize={\withoutpt\the\dimen0 cm,\withoutpt\the\dimen1 cm}% \endgroup }
we can use etex to get a fully expandable one: \def\metricdimension#1{\the\dimexpr0.0351459804\dimexpr#1\relax\relax cm} \def\writepapersize {\special{papersize=\metricdimension\paperwidth,\metricdimension\paperheight} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Tobias Burnus wrote:
Hello,
Peter Münster wrote:
On Fri, 27 May 2005, Tobias Burnus wrote:
Should be e.g. for "A4" \special{papersize=210mm,297mm} and for "A5" \special{papersize=148mm,210mm}. If I add this, it actually seems to work here. I failed to create something which obtains the papersize automatically.
Ok, the following works: \special{papersize=\the\paperwidth,\the\paperheight}
It puts (for \setuppapersize[letter][letter]) the following into the DVI file (dvips -d3 test2.dvi 2>&1 |grep special): papersize=614.295pt,794.96999pt which gv shows as letter. Having the right unit (as defined in page-lay.tex, i.e. 148mm×210mm for A5, 8.5in×11in for letter etc.) would be probably better, but this works.
Yes, that's the problem. I tried \special{papersize=\paperwidth,\paperheight}
That expands to: papersize=\paperwidth ,\paperheight which dvips cannot digest.
and \special{papersize=\PtToCm{\paperwidth},\PtToCm{\paperheight}}
Whereas that expands to
papersize=\begingroup \scratchdimen \paperwidth \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup ,\begingroup \scratchdimen \paperheight \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup
[1Processing special: papersize=\begingroup \scratchdimen \paperwidth \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup ,\begingroup \scratchdimen \paperheight \relax \scratchdimen 0.0351459804\scratchdimen 0.0cm\endgroup still something dvips cannot digest.
I have to admit, I actually fail to expand \special{papersize=\PtToCm{\the\paperwidth},\PtToCm{\the\paperheight}} correctly. It always ends up as \begingroup ... in the DVI file (i.e. as above with \paperheight|weight replaced by its numerical value).
how about adding something to spec-tr: \definespecial\dosetuppaper#1#2#3% {\special{papersize=#2,#3}} paper size is already supported in the other backends for ages -) is this special official? Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sat, 28 May 2005, Hans Hagen wrote:
how about adding something to spec-tr:
\definespecial\dosetuppaper#1#2#3% {\special{papersize=#2,#3}}
paper size is already supported in the other backends for ages -)
is this special official?
Hello Hans, I don't know, but here some lines from the dvips man-page: -t papertype [...] You should not use any -t option when the DVI file already contains a papersize special, as is done by some LaTeX packages, notably hyperref.sty. Greetings, Peter -- http://pmrb.free.fr/contact/
Peter Münster wrote:
On Sat, 28 May 2005, Hans Hagen wrote:
how about adding something to spec-tr:
\definespecial\dosetuppaper#1#2#3% {\special{papersize=#2,#3}}
paper size is already supported in the other backends for ages -)
is this special official?
Hello Hans, I don't know, but here some lines from the dvips man-page:
It's in the dvips manual as well: The format of the papersize special is \special{papersize=8.5in,11in} where the dimensions given above are for a standard letter sheet. The first dimension given is the horizontal size of the page, and the second is the vertical size. The dimensions supported are the same as for TeX; namely, in (inches), cm (centimeters), mm (millimeters), pt (points), sp (scaled points), bp (big points, the same as the default PostScript unit), pc (picas), dd (didot points), and cc (ciceros). For a landscape document, the papersize comment would be given as \special{papersize=11in,8.5in} It appears to be dvips-only, judging from the hyperref .def files. Taco
Taco Hoekwater wrote:
Peter Münster wrote:
On Sat, 28 May 2005, Hans Hagen wrote:
how about adding something to spec-tr:
\definespecial\dosetuppaper#1#2#3% {\special{papersize=#2,#3}}
paper size is already supported in the other backends for ages -)
is this special official?
Hello Hans, I don't know, but here some lines from the dvips man-page:
It's in the dvips manual as well:
The format of the papersize special is
\special{papersize=8.5in,11in}
where the dimensions given above are for a standard letter sheet. The first dimension given is the horizontal size of the page, and the second is the vertical size. The dimensions supported are the same as for TeX; namely, in (inches), cm (centimeters), mm (millimeters), pt (points), sp (scaled points), bp (big points, the same as the default PostScript unit), pc (picas), dd (didot points), and cc (ciceros).
For a landscape document, the papersize comment would be given as
\special{papersize=11in,8.5in}
It appears to be dvips-only, judging from the hyperref .def files.
ok, so i'll add it to spec-tr.tex thanks for doing the research Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hello, Hans Hagen wrote:
Ok, the following works: \special{papersize=\the\paperwidth,\the\paperheight}
how about adding something to spec-tr: \definespecial\dosetuppaper#1#2#3% {\special{papersize=#2,#3}} Ok. By the way, inserting in pt, cm or mm all works; i.e. this simple definition is ok, one does not need to convert to cm.
is this special official? Hmm, I don't know how official it is, but it is used by hyperref and documented, e.g. at http://www.ifi.uni-klu.ac.at/Public/Documentation/dvips/dvips_3.html; this document is for dvips version 5.58f (January 1995). One can thus expect that is is actually supported by most installed TeXs ;)
Tobias
On Sat, 28 May 2005, Tobias Burnus wrote:
Ok, the following works: \special{papersize=\the\paperwidth,\the\paperheight}
Hello Tobias, thank you! (I really don't know, why I forgot to test this alternative...) Greetings, Peter -- http://pmrb.free.fr/contact/
participants (4)
-
Hans Hagen
-
Peter Münster
-
Taco Hoekwater
-
Tobias Burnus