0

I'm trying to generate a pdf-x with pdfxpackage.

If I compile the following mwe with LuaLaTeX or XeLaTeX

\documentclass{memoir}
\usepackage{lipsum}

\setstocksize{29.7cm}{21cm}
\settrimmedsize{21cm}{13cm}{*}
\settypeblocksize{*}{9.1cm}{1.618}
\setlrmargins{1.5cm}{*}{*}
\setulmargins{2.12cm}{*}{2}
\checkandfixthelayout

\usepackage[x-1a]{pdfx}

\begin{document}

\lipsum

\end{document}

the layout gets messed up. It seems that the problem is between pdfx and memoir's \settrimmedsize: if I set the trimmed size identical with the stock size, the problem disappears.

As a matter of fact, the problem disappears also when I generate pdf type a-1b (with \usepackage[a-1b]{pdfx}).

Does anyone have an idea where the issue come from, and how to fix it?

2
  • unrelated but don't use \usepackage[utf8]{inputenc} with lualatex and xelatex (it won't harm but is unneeded.) Commented Feb 16, 2022 at 16:55
  • Thanks @UlrikeFischer. Yes, I'll edit the mwe according to your indication. Commented Feb 16, 2022 at 17:12

1 Answer 1

1

pdfx doesn't take memoir's dimensions into account and uses \paperwidth instead of \stockwidth for the mediabox. You can reset this like this (with lualatex and pdflatex, xelatex needs different code), but you probably will have to adapt the values of the other boxes too--I simply copied the values currently used by pdfx.

\documentclass{memoir}

\usepackage{lipsum}

\setstocksize{29.7cm}{21cm}
\settrimmedsize{21cm}{13cm}{*}
\settypeblocksize{*}{9.1cm}{1.618}
\setlrmargins{1.5cm}{*}{*}
\setulmargins{2.12cm}{*}{2}
\checkandfixthelayout

\usepackage[x-1a]{pdfx}

\ExplSyntaxOn
\exp_args:Nx
\pdfpagesattr
  {
    /MediaBox[0~0~\dim_to_decimal:n{0.996264009963\stockwidth}~\dim_to_decimal:n{0.996264009963\stockheight}]
    /BleedBox[0~0~\dim_to_decimal:n{0.996264009963\stockwidth}~\dim_to_decimal:n{0.996264009963\stockheight}]
    /CropBox[0~0~\dim_to_decimal:n{0.996264009963\stockwidth}~\dim_to_decimal:n{0.996264009963\stockheight}]
    /TrimBox[25~20~\dim_to_decimal:n{0.996264009963\stockwidth-25pt}~\dim_to_decimal:n{0.996264009963\stockheight-20pt}]
  }
\ExplSyntaxOff   
   
\begin{document}

\lipsum

\end{document}
3
  • Thanks a lot @UlrikeFischer! It works for me without adapting anything. Just a question, if I can: what does the number 0.996264009963 mean? I would expect just \stockwidth... Doesn't it imply any resizing, does it? Commented Feb 16, 2022 at 19:25
  • the values in the pdf are in bp, the number is the ratio 72/72,27, so the difference between bp and pt. Commented Feb 16, 2022 at 19:51
  • Wonderful, thanks again! Commented Feb 16, 2022 at 20:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .