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

pdfjam seems to change the margins when printing A5 pages to A4 as booklet #37

Open
rrthomas opened this issue Nov 17, 2020 · 9 comments

Comments

@rrthomas
Copy link
Owner

If I run:

pdfjam --landscape --suffix book foo.pdf --booklet true --paper a4

where foo.pdf is A5, then the A5 pages are not simply impressed on the A4 sheet; the margins are changed. See jenom/pdfbook2#10

@DavidFirth
Copy link
Collaborator

My usual approach to diagnosing a problem like this is to run again with --no-tidy, and then get the resulting .tex file, to check that against the documentation of the pdfpages package.

@rrthomas
Copy link
Owner Author

Thanks for the hint! So in my case, a.tex is:

\batchmode
\documentclass[a4,landscape]{article}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}

\begin{document}
\includepdfmerge[booklet=true]{/tmp/pdfjam-tZUmNi/source-1.pdf,-}
\end{document}

No mention that I can find of any margins. I tried adding the noautoscale=true option to \includepdfmerge, which changed the margins but without fixing them. Removing booklet=true and changing to a4,landscape to a5paper restores the correct margins (the process is now logically a no-op). Adding back a4,landscape and adding the option nup=2x1 to \includepdfmerge makes the margins go wrong again, suggesting the problem is with the nup option: both delta and offset default to zero, and centring A5 pages on A4 2up should obviously not change them.

I've written to Andreas Matthias with a bug report for pdfpages.

@rrthomas
Copy link
Owner Author

rrthomas commented Nov 18, 2020

I found the bug:

LaTeX Warning: Unused global option(s):
    [a4].

That should be a4paper. In this case it's my error (because I typed --paper a4), though it would be nice if pdfjam gave a warning at least.

@rrthomas
Copy link
Owner Author

For example, by treating warnings as errors? Would this be a reasonable thing to do with pdfjam?

https://stackoverflow.com/questions/3244908/how-do-i-treat-latex-warnings-as-errors

@rrthomas
Copy link
Owner Author

There's one remaining problem I realize I haven't gotten to the bottom of: I shouldn't've needed to specify the paper size in the first place, as pdfjam should have the right default. When I execute pdfjam --help it says:

                  [Default for you at this site: paper=]

So either TeXLive, or Ubuntu's packaging of it, have not wired it up with appropriate defaults? (Looking at the rest of the --help output, no default is set.

@DavidFirth
Copy link
Collaborator

I found the bug:

LaTeX Warning: Unused global option(s):
    [a4].

That should be a4paper. In this case it's my error (because I typed --paper a4), though it would be nice if pdfjam gave a warning at least.

I agree, that would be nice.

@DavidFirth
Copy link
Collaborator

For example, by treating warnings as errors? Would this be a reasonable thing to do with pdfjam?

https://stackoverflow.com/questions/3244908/how-do-i-treat-latex-warnings-as-errors

Well, LaTeX does tend to give a lot of warnings. So this might not be a great idea I suspect.

Worth noting that the values allowed for --paper are all the ones allowed by LtTeX, plus all the ones allowed by the geometry package. That's a potentially moving target. So constructing a reliable test for a valid --paper setting might not be so easy. (I guess that's why I didn't do it from the start.)

@rrthomas
Copy link
Owner Author

Yes, I thought about that: in general it gives a lot of warnings, but I'm not sure that it should for a document constructed by pdfjam. Maybe worth a try…

@DavidFirth
Copy link
Collaborator

There's one remaining problem I realize I haven't gotten to the bottom of: I shouldn't've needed to specify the paper size in the first place, as pdfjam should have the right default. When I execute pdfjam --help it says:

                  [Default for you at this site: paper=]

So either TeXLive, or Ubuntu's packaging of it, have not wired it up with appropriate defaults? (Looking at the rest of the --help output, no default is set.

Oh, this is indeed unfortunate, and not intended. I can confirm that the same holds on my fresh install of TeXLive in Fedora 33.

The relevant part of the README at https://github.com/rrthomas/pdfjam#config tells someone how to configure their installation of pdfjam. But of course TeXLive does not actually do any of that; instead it just keeps a copy of the pdfjam.conf template in the pdfjam directory inside the TeXLive installation. I don't know what would be a good way around this, ie something that robustly helps users who have installed pdfjam via TeXLive.

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

2 participants