TextPos 与 Booklet 和 Twoup 不兼容

TextPos 与 Booklet 和 Twoup 不兼容

booklet我正在使用、twoup和的组合textpos来创建可打印的小册子,但在打印模式下文本块的位置出现了奇怪的问题。我以前用过这种组合来制作可以在家用打印机上打印的文档,效果非常好。

当在模式booklet下进行编译时noprint,一切都运行良好,并且它会在半信纸大小的纸张上产生正确的输出(或者,如果您愿意,可以切换到 a5)。

然而,在print模式下编译时,文本块会延迟到后页(封底)。

改变加载包的顺序并没有产生任何积极的结果。

我有以下 MNWE,它是我制作并用于制作小册子的模板的精简版。我最近更新了我的 TeX 发行版,这可能是问题的根源。

\documentclass[10pt,letterpaper]{article}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{lipsum} 

\usepackage[noprint,1to1]{booklet}          % run once, to set text on half-page
%\usepackage[print,1to1]{booklet}\nofiles   % final run, create the printable document  
\usepackage{twoup}
\usepackage[absolute,overlay]{textpos}  % allows for absolute placement of text

% this will set a half-letter size paper sheet, for making a `zine 
\setlength{\paperwidth}{5.5in}          % width = 11/2 = 5.5in
\setlength{\paperheight}{8.5in}         % height = 8.5in, width of letter paper

%% This command is necessary when using the booklet package
\AtBeginDocument{\setpdftargetpages}

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FRONT PAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{titlepage}
\thispagestyle{empty}
    \TPGrid{16}{16}
    \begin{textblock}{16}(0,2)
        \centering
        \noindent \fbox{\huge FRONT PAGE}
    \end{textblock}
    \begin{textblock}{16}[0.5,0.5](8,8)
        \centering
        \begin{tikzpicture}
            \draw(0,0) rectangle (12,14);
        \end{tikzpicture}
    \end{textblock}
\end{titlepage}
\pagenumbering{gobble}
\mbox{}
\null\ ~ % use all of them for good measure
\clearpage
\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FIRST SPREAD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagenumbering{arabic} %this restarts page numbering with standard numbers

% page 1
\section{FIRST PAGE}
\TPGrid{16}{16}
\begin{textblock}{10}[0.5,0.5](8,6)
    \fbox{\textcolor{blue}{THIS CONTENT BELONGS ON FIRST PAGE}}
\end{textblock}
\subsection{some text}
\lipsum[6]
\mbox{}
\null\ ~ % use all of them for good measure
\clearpage
\newpage

% page 2
\section{SECOND PAGE}
\lipsum[1-2]
\mbox{}
\clearpage
\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% BACK COVER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{titlepage}
\thispagestyle{empty}
    \TPGrid{16}{16}
    \begin{textblock}{16}[0.5,0.5](8,8)
        \centering
        \begin{tikzpicture}
            \draw(0,0) rectangle (12,14);
        \end{tikzpicture}
    \end{textblock}
    \begin{textblock}{16}[0.5,0.5](8,14)
        \centering
        \fbox{\huge \textcolor{red}{BACK PAGE}}
    \end{textblock}
\end{titlepage}
\mbox{}
\null\ ~
\clearpage
\newpage

\end{document}

要重现该错误,请先使用noprintbooklet 包的选项进行编译。然后注释掉此行,取消注释下面的行以使用该print选项进行编译。

第一次编译时,文本块将出现在正确的页面上。第二次编译时,为了制作小册子,文本块全部出现在背面(出现在第一张完整纸张的左侧)。其他元素按预期显示。

除了文本块之外,其他一切都运行良好。这包括\includegraphics命令、内部表格、内部和外部超链接以及其他布局选择。

我在 Mac 上进行编译,使用 TexShop v 4.70 和 TexLive 2022。如果 MNWE 适合您,请告诉我您的版本。

任何建议都值得赞赏。我已经花了几个小时来研究这个问题,但在这两个包的文档中都没有找到任何答案。

答案1

我设法制作了一个较小的MWE:

\documentclass{article}

%\usepackage[noprint,1to1]{booklet}       % this works as expected
\usepackage[print,1to1]{booklet} % this doesn't
\AtBeginDocument{\setpdftargetpages}

% both of the following show the same behaviour
\usepackage[absolute]{textpos}
%\usepackage[absolute,overlay]{textpos}

\TPGrid{16}{16}

% We expect the text 'Page 1' and 'front page textblock' to appear on
% the first page, of four in the booklet.
%
% However the textblock in fact ends up on the last page of the 4-page
% signature.

\begin{document}
Page 1
\begin{textblock}{10}(8,8)
front page textblock
\end{textblock}
\end{document}

我认为这里的问题可能出在booklet包裹上。

我注意到该booklet软件包重新定义了\shipout。1.9 和 1.10 之间的重要变化textpos是(在 CTAN 维护人员的提示下)它更改为支持新的 LaTeX3 shipout 挂钩。看起来该booklet软件包尚未做到这一点(TeXLive 2022 似乎包含“booklet 2009/09/02 v0.7b”,因此早于更改),这意味着textpos1.10 和booklet不会成为朋友,而且实际上可能会booklet与使用新 shipout 挂钩的其他软件包表现不稳定。值得注意的是,软件包everyshi(提供 的软件包\EveryShipout)已宣布自己已过时,现在仅用作兼容性垫片,根据新的 shipout 挂钩实现。

然而,我可以向 OP 建议一个替代策略。

当我想要制作小册子/签名时,我会使用这个pdfpages包。要使用这个包,我消除从上述文档中取出小册子包,将其编译为,并创建一个包含以下内容的try-mwe.pdf单独文档:try-booklet.tex

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-,landscape,booklet]{try-mwe.pdf}
\end{document}

然后我可以运行 pdflatex 来try-booklet.tex获得一本 4 页的小册子。这会缩小输入文档,因此为了获得预期的效果,我必须放大原始文档中的所有尺寸。这意味着组装文档涉及两个步骤和一些额外的算术,但这意味着所有 PDF 操作都局限于一个单独的、孤立的步骤。

相关内容