Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color and pagesize #36

Open
GHT54 opened this issue Oct 8, 2022 · 4 comments
Open

color and pagesize #36

GHT54 opened this issue Oct 8, 2022 · 4 comments

Comments

@GHT54
Copy link

GHT54 commented Oct 8, 2022

The two following files produce different output

File 1
\input eplain
\hsize=210mm
\input miniltx
\input color
\the\pdfpageheight
\end

File 2
\input eplain
\hsize=210mm
\input miniltx
%\input color
\the\pdfpageheight
\end

test2.log

@muzimuzhi
Copy link
Contributor

  • TeX Live is installed with A4 paper chosen by default
    See answer by Enrico Gregorio (egreg) on TeX.SX and stdout of tlmgr paper.
    • For pdftex, \pdfpageheight is initialized to 297 true mm (in pdftexconfig.tex), the height of A4 paper.
  • eplain.tex declares \paperheight with initial value (11in) for letter paper.
  • Page size of the resulted PDF is controlled by \pdfpageheight.

Then,

  • Without \input color, the initial value of \pdfpageheight for A4 paper is effected.
  • With \input color, the \pdfpageheight is set equal to the \paperheight in color driver file (pdftex.def for pdftex engine), thus the resulted page size in PDF becomes letter paper.

This difference also happens in LaTeX:

\documentclass{article}
% \usepackage{color} % or any other pacakge which loads color/graphics driver

\begin{document}
content
\end{document}

In the LaTeX example above, the article document class always uses letterpaper class option, but it only actually affect the page size when color driver is loaded.

As letter paper has been the default paper size of LaTeX for decades, it seems to me the result with color driver loaded is the expected one.

@davidcarlisle
Copy link
Member

davidcarlisle commented Dec 4, 2024

LaTeX by default does not set the pdf page size at all (as the syntax to do that depends on the back end in use, pdftex, or latex/dvips or latex/dvipdfmx etc) once a back end has been chosen (color, or graphics or hyperref or geometry packages for example all force a choice of back end) then the pdf page size (\pdfpageheight for pdftex) is set to the latex parameter \paperheight (and similarly for width)

To you get the equivalent to latex behaviour. You can set \paperheight

\input eplain
\showthe\pdfpageheight
\hsize=210mm
\input miniltx
\paperheight=\pdfpageheight
\input color
\showthe\pdfpageheight
\end

Then you get 845.04684pt whether or not color is loaded.

muzimuzhi added a commit to muzimuzhi/tabularray-dev that referenced this issue Dec 4, 2024
Paper size may change by loading of xcolor, esp. the graphics driver.
latex3/graphics-def#36

Also shorten the name of test, to be consistent with upstream.
@muzimuzhi
Copy link
Contributor

your eplain code never sets \paperheight so you get the default latex behaviour.

@davidcarlisle I assume you meant \pdfpageheight here? Because eplain does set \paperheight (to 11in if \mag=1000 or 11truein otherwise).

@davidcarlisle
Copy link
Member

@muzimuzhi oops, I meant what I wrote but it wasn't right as you say. Maybe I'll delete the first comment and correct later, thanks

@davidcarlisle davidcarlisle reopened this Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants