我正在尝试使用更大页面集中的子集制作讲义。到目前为止,我成功地使用以下方法将四页放在一页上:
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper,border shrink=2.5mm,landscape]
但问题是,我只想要讲义上总页数的一部分,比如第 6 至 13 页。不幸的是,例如,第 6 页现在与其他四页共用一页,包括第 5 页,而我不想将其放在讲义上。因此,我无法手动剪下讲义上需要的页面。
是否可以使用我的pgfpages
选项来告诉 LaTeX 仅输出第 6 至 13 页,但保持其他所有条件相同?
答案1
您可以使用仅编译页面范围或页面选择:
\documentclass{article}
\usepackage{pgfpages}% http://ctan.org/pkg/pgf
\pgfpagesuselayout{4 on 1}[a4paper,border shrink=2.5mm,landscape]
% Taken from https://tex.stackexchange.com/q/96256/5764
\usepackage{multido,atbegshi,etoolbox}% http://ctan.org/pkg/{lipsum,atbegshi,etoolbox}
\makeatletter
\newcommand{\discardpages}[1]{% \discardpages{<csv list>}
\xdef\discard@pages{#1}% Store pages to discard
\AtBeginShipout{% At shipout, decide whether to discard page/not
\renewcommand*{\do}[1]{% How to handle each page entry in csv list
\ifnum\value{page}=##1\relax%
\AtBeginShipoutDiscard% Discard page/not
\gdef\do####1{}% Do nothing further
\fi%
}%
\expandafter\docsvlist\expandafter{\discard@pages}% Process list of pages to discard
}%
}
\newif\ifkeeppage
\newcommand{\keeppages}[1]{% \keeppages{<csv list>}
\xdef\keep@pages{#1}% Store pages to keep
\AtBeginShipout{% At shipout, decide whether to discard page/not
\keeppagefalse%
\renewcommand*{\do}[1]{% How to handle each page entry in csv list
\ifnum\value{page}=##1\relax%
\keeppagetrue% Page should be kept
\gdef\do####1{}% Do nothing further
\fi%
}%
\expandafter\docsvlist\expandafter{\keep@pages}% Process list of pages to keep
\ifkeeppage\else\AtBeginShipoutDiscard\fi% Discard page/not
}%
}
\makeatother
\keeppages{6,7,8,9,10,11,12,13}% Keep only these pages
\begin{document}
\multido{\iA=1+1}{20}{\scalebox{40}{\iA}\newpage}
\end{document}
答案2
我找到了一种方法来做到这一点:
首先,我将全文编译为full.pdf
。然后使用以下代码运行:
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper,border shrink=-30mm,landscape]
\usepackage{pdfpages}
\begin{document}
\includepdf[pages={6-12}]{full.pdf}
\end{document}
我不得不手动调整边框,将其缩小(border shrink=-30mm
)。这个解决方案非常好,让我们可以使用页面范围(pages={6-12}
)。