ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* dvi paper-size
@ 2005-05-27 18:09 Peter Münster
  2005-05-27 19:40 ` Tobias Burnus
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Münster @ 2005-05-27 18:09 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-27 18:09 dvi paper-size Peter Münster
@ 2005-05-27 19:40 ` Tobias Burnus
  2005-05-28  6:55   ` Peter Münster
  0 siblings, 1 reply; 12+ messages in thread
From: Tobias Burnus @ 2005-05-27 19:40 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-27 19:40 ` Tobias Burnus
@ 2005-05-28  6:55   ` Peter Münster
  2005-05-28  8:45     ` Tobias Burnus
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Münster @ 2005-05-28  6:55 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28  6:55   ` Peter Münster
@ 2005-05-28  8:45     ` Tobias Burnus
  2005-05-28  9:01       ` Taco Hoekwater
                         ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Tobias Burnus @ 2005-05-28  8:45 UTC (permalink / raw)


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
<cmr12.pfb>[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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28  8:45     ` Tobias Burnus
@ 2005-05-28  9:01       ` Taco Hoekwater
  2005-05-28  9:41         ` Hans Hagen
  2005-05-28  9:37       ` Hans Hagen
  2005-05-28 11:58       ` Peter Münster
  2 siblings, 1 reply; 12+ messages in thread
From: Taco Hoekwater @ 2005-05-28  9:01 UTC (permalink / raw)



\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
> <cmr12.pfb>[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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28  8:45     ` Tobias Burnus
  2005-05-28  9:01       ` Taco Hoekwater
@ 2005-05-28  9:37       ` Hans Hagen
  2005-05-28 12:16         ` Peter Münster
  2005-05-28 12:52         ` Tobias Burnus
  2005-05-28 11:58       ` Peter Münster
  2 siblings, 2 replies; 12+ messages in thread
From: Hans Hagen @ 2005-05-28  9:37 UTC (permalink / raw)


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
> <cmr12.pfb>[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
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28  9:01       ` Taco Hoekwater
@ 2005-05-28  9:41         ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2005-05-28  9:41 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28  8:45     ` Tobias Burnus
  2005-05-28  9:01       ` Taco Hoekwater
  2005-05-28  9:37       ` Hans Hagen
@ 2005-05-28 11:58       ` Peter Münster
  2 siblings, 0 replies; 12+ messages in thread
From: Peter Münster @ 2005-05-28 11:58 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28  9:37       ` Hans Hagen
@ 2005-05-28 12:16         ` Peter Münster
  2005-05-28 12:31           ` Taco Hoekwater
  2005-05-28 12:52         ` Tobias Burnus
  1 sibling, 1 reply; 12+ messages in thread
From: Peter Münster @ 2005-05-28 12:16 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28 12:16         ` Peter Münster
@ 2005-05-28 12:31           ` Taco Hoekwater
  2005-05-29 17:00             ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Taco Hoekwater @ 2005-05-28 12:31 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28  9:37       ` Hans Hagen
  2005-05-28 12:16         ` Peter Münster
@ 2005-05-28 12:52         ` Tobias Burnus
  1 sibling, 0 replies; 12+ messages in thread
From: Tobias Burnus @ 2005-05-28 12:52 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: dvi paper-size
  2005-05-28 12:31           ` Taco Hoekwater
@ 2005-05-29 17:00             ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2005-05-29 17:00 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-05-29 17:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-27 18:09 dvi paper-size Peter Münster
2005-05-27 19:40 ` Tobias Burnus
2005-05-28  6:55   ` Peter Münster
2005-05-28  8:45     ` Tobias Burnus
2005-05-28  9:01       ` Taco Hoekwater
2005-05-28  9:41         ` Hans Hagen
2005-05-28  9:37       ` Hans Hagen
2005-05-28 12:16         ` Peter Münster
2005-05-28 12:31           ` Taco Hoekwater
2005-05-29 17:00             ` Hans Hagen
2005-05-28 12:52         ` Tobias Burnus
2005-05-28 11:58       ` Peter Münster

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