latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.9k stars 263 forks source link

Definition of paper sizes #1371

Closed rolfn closed 3 months ago

rolfn commented 3 months ago

Brief outline of the enhancement

Paper sizes are defined within the standard classes, but these definitions are not generally applicable and are not complete (e.g. »b6paper« is missing). Other classes (»memoir«, »koma-script«) go their own way of defining paper sizes. My suggestion is therefore: Standard LaTeX should provide an universal interface so that class and package authors can access the most important definitions of paper sizes. Perhaps a "paper template" would be useful?

davidcarlisle commented 3 months ago

Speaking personally, I'm not sure there is a lot that can be done in general. Obviously we could set up a package (or configuration of some sort) with the basic height and width information for a list of sizes (but probably that is already covered by geometry (which already has b6paper, see its list below) but most of what a size option does is more subjective and class specific, choice of suitable margins, and columns widths etc. geometry does quite a good job of choosing such settings for designs that are relatively close to the standard classes, and as you say, the Koma script classes have such features integrated into the class structure.

\@namedef{Gm@a0paper}#1{\Gm@setsize{#1}(841,1189){mm}}% ISO A0
\@namedef{Gm@a1paper}#1{\Gm@setsize{#1}(594,841){mm}}% ISO A1
\@namedef{Gm@a2paper}#1{\Gm@setsize{#1}(420,594){mm}}% ISO A2
\@namedef{Gm@a3paper}#1{\Gm@setsize{#1}(297,420){mm}}% ISO A3
\@namedef{Gm@a4paper}#1{\Gm@setsize{#1}(210,297){mm}}% ISO A4
\@namedef{Gm@a5paper}#1{\Gm@setsize{#1}(148,210){mm}}% ISO A5
\@namedef{Gm@a6paper}#1{\Gm@setsize{#1}(105,148){mm}}% ISO A6
\@namedef{Gm@b0paper}#1{\Gm@setsize{#1}(1000,1414){mm}}% ISO B0
\@namedef{Gm@b1paper}#1{\Gm@setsize{#1}(707,1000){mm}}% ISO B1
\@namedef{Gm@b2paper}#1{\Gm@setsize{#1}(500,707){mm}}% ISO B2
\@namedef{Gm@b3paper}#1{\Gm@setsize{#1}(353,500){mm}}% ISO B3
\@namedef{Gm@b4paper}#1{\Gm@setsize{#1}(250,353){mm}}% ISO B4
\@namedef{Gm@b5paper}#1{\Gm@setsize{#1}(176,250){mm}}% ISO B5
\@namedef{Gm@b6paper}#1{\Gm@setsize{#1}(125,176){mm}}% ISO B6
\@namedef{Gm@c0paper}#1{\Gm@setsize{#1}(917,1297){mm}}% ISO C0
\@namedef{Gm@c1paper}#1{\Gm@setsize{#1}(648,917){mm}}% ISO C1
\@namedef{Gm@c2paper}#1{\Gm@setsize{#1}(458,648){mm}}% ISO C2
\@namedef{Gm@c3paper}#1{\Gm@setsize{#1}(324,458){mm}}% ISO C3
\@namedef{Gm@c4paper}#1{\Gm@setsize{#1}(229,324){mm}}% ISO C4
\@namedef{Gm@c5paper}#1{\Gm@setsize{#1}(162,229){mm}}% ISO C5
\@namedef{Gm@c6paper}#1{\Gm@setsize{#1}(114,162){mm}}% ISO C6
\@namedef{Gm@b0j}#1{\Gm@setsize{#1}(1030,1456){mm}}% JIS B0
\@namedef{Gm@b1j}#1{\Gm@setsize{#1}(728,1030){mm}}% JIS B1
\@namedef{Gm@b2j}#1{\Gm@setsize{#1}(515,728){mm}}% JIS B2
\@namedef{Gm@b3j}#1{\Gm@setsize{#1}(364,515){mm}}% JIS B3
\@namedef{Gm@b4j}#1{\Gm@setsize{#1}(257,364){mm}}% JIS B4
\@namedef{Gm@b5j}#1{\Gm@setsize{#1}(182,257){mm}}% JIS B5
\@namedef{Gm@b6j}#1{\Gm@setsize{#1}(128,182){mm}}% JIS B6
\@namedef{Gm@ansiapaper}#1{\Gm@setsize{#1}(8.5,11){in}}%
\@namedef{Gm@ansibpaper}#1{\Gm@setsize{#1}(11,17){in}}%
\@namedef{Gm@ansicpaper}#1{\Gm@setsize{#1}(17,22){in}}%
\@namedef{Gm@ansidpaper}#1{\Gm@setsize{#1}(22,34){in}}%
\@namedef{Gm@ansiepaper}#1{\Gm@setsize{#1}(34,44){in}}%
\@namedef{Gm@letterpaper}#1{\Gm@setsize{#1}(8.5,11){in}}%
\@namedef{Gm@legalpaper}#1{\Gm@setsize{#1}(8.5,14){in}}%
\@namedef{Gm@executivepaper}#1{\Gm@setsize{#1}(7.25,10.5){in}}%
\@namedef{Gm@screen}#1{\Gm@setsize{#1}(225,180){mm}}%
rolfn commented 3 months ago

You're right. I forgot geometry. geometry defines a large number of paper sizes and it is easy to set (!) a paper size, but there is no good interface to query (!) a specific paper size.

It may be better, though, if I ask the author of geometry to implement this.

davidcarlisle commented 3 months ago

you could, but if you make an issue at the geometry repository it comes back to the same people as it happens. I'm not sure if a query makes a lot of sense given that the page size can be set directly, if someone calls a6paper option and then adds 2cm to \paperheight querying the paper size and being told a6paper would be misleading. The only safe thing is to look at the set lengths \paperheight and \paperwidth which needs no package, they may or may not correspond to a standard paper size, but I'm not sure if a lookup table is that useful.

rolfn commented 3 months ago

The actual reason for my request here is my package blowup. It allows scaling the pages of an already complete document of a certain paper size to another paper size and other fine-tuning. For this I need paper sizes explicitly. So far I have been loading the package typearray (part of "koma-script") to get this information, but this is not a good solution because side effects cannot be ruled out. A simple interface would therefore be welcome. I know, of course, that my request is not of particular importance.

FrankMittelbach commented 3 months ago

@rolfn to be honest what you need I would just keep the necessary papersize definitions local to your package without generating a dependency between packages, maybe by just copying the data from geometry. Sure, there could be a central repository and perhaps that will happen, when we integrate the geometry code closer with the kernel; but that would serve at best a handful of packages of which 1-2 (your's included) maybe make use of it and the others would stay with their solution. So I can't see that this is overly beneficial.

I guess I'm closing this as "not planned" for now, neither in the kernel nor in geometry (by the way, if you load geometry it wouldn't been hard to define a macro that runs one of these \Gm@... definitions and extracts the data along the way).