# proper alignment of pdfpages import in memoir typeblock

Finding the solution to Setting up pdfpages with memoir? turned out not to be as simple as adding the right layout parameter as an offset.

The first finding was that if a twoside documentclass is used, pdfpages considerably misalignes the included PDF. By comparing the memoir layout parameters for oneside and twoside options (\the\<parameter>), the misalignment could quickly be determined as likely to be caused by the difference in \spinemargin, which is one of only two layout parameters that actually differ between oneside and twoside (both parameters are emphasized in the table below). The difference in \spinemargin was hence added as an offset to the pdfpages import.

However, a slight misalignment, which is also present with oneside option, remains. The figure shows the result of including a borderless, completely red-coloured PDF into a memoir class with documentclass options in the order of the table column headers; the black line is part of the typeblock's left border, visualized by the showframe package (cf. Code).

For letter, the misalignment has been found to be less than 1pt, while for a4paper it is somewhere in between 1pt and 2pt.

Questions

(1) Besides being a "good fit", is there other evidence that it is \spinemargin that causes the offset between oneside and twoside layout?
(2) What causes the remaining misalignment, and can its amount precisely be determined?

## Code

\documentclass[oneside]{memoir}

\usepackage{pdfpages}
\usepackage{showframe}

\begin{document}

\includepdf[pages=1,
pagecommand={\thispagestyle{empty}},
width=\textwidth,
height=\textheight,
keepaspectratio,
offset=0pt 0pt,     %letter, oneside    => misaligned by .x pt
]{red.pdf}
\end{document}