次の例を考えてみましょう。
ファイル:B.tex
\documentclass[
12pt,
landscape
]{article}
\usepackage[
a6paper
]{geometry}
\usepackage{multido}
\newenvironment{navn}{%
\setlength{\topskip}{0pt}%
\centering
\vspace*{\fill}%
\nointerlineskip
\Huge
% \sbox0{Front}%
% \showthe\ht0
}{%
\par
\vspace*{\fill}%
% \setlength{\showboxdepth}{\maxdimen}%
% \setlength{\showboxbreadth}{\maxdimen}%
% \tracingonline=1 %
% \showlists
}
\pagestyle{empty}
\begin{document}
\multido{\i = 1+1}{16}{%
\begin{navn}
Front
\end{navn}
\newpage}
\end{document}
ファイル:C.tex
\documentclass[
12pt,
landscape
]{article}
\usepackage[
a6paper
]{geometry}
\usepackage{multido}
\newenvironment{navn}{%
\setlength{\topskip}{0pt}%
\centering
\vspace*{\fill}%
\nointerlineskip
\Huge
% \sbox0{XYZ}%
% \showthe\ht0
}{%
\par
\vspace{\fill}%
% \setlength{\showboxdepth}{\maxdimen}%
% \setlength{\showboxbreadth}{\maxdimen}%
% \tracingonline=1 %
% \showlists
}
\pagestyle{empty}
\begin{document}
\multido{\i = 1+1}{16}{%
\begin{navn}
\thepage
\end{navn}
\newpage}
\end{document}
ファイル:A.tex
\documentclass[
a4paper
]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[
nup = 2x4,
pages = -,
frame = true
]{B}
\includepdf[
nup = 2x4,
pages = -
]{C}
\end{document}
(書類B.tex
とC.tex
実際はもっと大きいです。)
質問
更新しました
ページの順序を変更するにはどうすればいいですか?A.pdf
?
Bp1、Bp2、...、Bpn、Cp1、Cp2、...、Cpn
に
Bp1、...、Bp8、Cp1、...、Cp8、[...]、Bp(n-8)、...、Bpn、Cp(n-8)、Cpn
任意のnに対して?
つまり、 では、A.pdf
からのページのみをB.pdf
最初のページに表示し、 からのページのみをC.pdf
2 番目のページに表示したい、ということになります。
答え1
以前のコードを削除したので、この回答はあなたの質問の最新の編集に適合します。
以下のコードは、必要な処理を実行します (および、とのページ数が同じかどうかを確認しC.pdf
、同じでない場合は、ページ数が少ない方の最後のページまで印刷し (片方のページに 、もう一方のページB.pdf
に がある両面印刷のような方法で)、その後、ページ数が多い方の残りを印刷します)。オプションの引数を受け入れるため、両方の PDF のすべてのページではなく、固定の最大ページを指定できます (ただし、固定の最大ページでは、両方の PDF にそのページ数があるかどうかは確認されません)。B
C
\documentclass[
a4paper
]{article}
\usepackage{pdfpages}
\newcount\maxpages
\newcount\curpage
\newcount\untilpage
\makeatletter
\newif\if@pdfdingsunbalance
\newcount\@testmaxpages
\newcommand{\@incpdfdings}[3]{\includepdf[nup=2x4,pages={#1-#2},frame=true]{#3}}
\newcommand{\incpdfdings}[3][]{%
\ifx\relax#1\relax%
\pdfximage{#2}%
\maxpages=\pdflastximagepages%
\pdfximage{#3}%
\@testmaxpages=\pdflastximagepages%
\ifnum\maxpages<\@testmaxpages%
\@pdfdingsunbalancetrue%
\def\@pdfdingsmore{#3}%
\else\ifnum\@testmaxpages<\maxpages%
\@pdfdingsunbalancetrue%
\def\@pdfdingsmore{#2}%
\maxpages=\@testmaxpages%
\fi\fi%
\else%
\maxpages=#1%
\fi%
\curpage=0%
\loop\ifnum\maxpages>\curpage%
\advance\curpage by 1%
\untilpage=\numexpr\curpage+7\relax%
\ifnum\maxpages>\untilpage\else%
\untilpage=\maxpages%
\fi%
\@incpdfdings{\the\curpage}{\the\untilpage}{#2}%
\@incpdfdings{\the\curpage}{\the\untilpage}{#3}%
\advance\curpage by 7%
\repeat%
\if@pdfdingsunbalance%
\advance\maxpages by 1%
\@incpdfdings{\the\maxpages}{}{\@pdfdingsmore}%
\fi%
}
\makeatother
\begin{document}
\incpdfdings{B.pdf}{C.pdf}
\end{document}
編集: とにかくエラー検出を投稿します (警告がスローされます):
\documentclass[
a4paper
]{article}
\usepackage{pdfpages}
\newcount\maxpages
\newcount\curpage
\newcount\untilpage
\makeatletter
\newif\if@pdfdingsunbalance
\newcount\@testmaxpages
\newcommand{\@incpdfdings}[3]{\includepdf[nup=2x4,pages={#1-#2},frame=true]{#3}}
\newcommand{\incpdfdings}[3][]{%
\ifx\relax#1\relax%
\pdfximage{#2}%
\maxpages=\pdflastximagepages%
\pdfximage{#3}%
\@testmaxpages=\pdflastximagepages%
\ifnum\maxpages<\@testmaxpages%
\@pdfdingsunbalancetrue%
\def\@pdfdingsmore{#3}%
\else\ifnum\@testmaxpages<\maxpages%
\@pdfdingsunbalancetrue%
\def\@pdfdingsmore{#2}%
\maxpages=\@testmaxpages%
\fi\fi%
\else%
\maxpages=#1%
\pdfximage{#2}%
\@testmaxpages=\pdflastximagepages%
\ifnum\maxpages>\@testmaxpages%
\@latex@warning{The file #2 you wanted to be printed with
incpdfdings doesn't have enough pages to match your request in
the optional argument}%
\maxpages=\@testmaxpages%
\fi%
\pdfximage{#3}%
\@testmaxpages=\pdflastximagepages%
\ifnum#1>\@testmaxpages%
\@latex@warning{The file #3 you wanted to be printed with
incpdfdings doesn't have enough pages to match your request in
the optional argument}%
\ifnum\maxpages>\@testmaxpages%
\maxpages=\@testmaxpages%
\fi\fi%
\fi%
\curpage=0%
\loop\ifnum\maxpages>\curpage%
\advance\curpage by 1%
\untilpage=\numexpr\curpage+7\relax%
\ifnum\maxpages>\untilpage\else%
\untilpage=\maxpages%
\fi%
\@incpdfdings{\the\curpage}{\the\untilpage}{#2}%
\@incpdfdings{\the\curpage}{\the\untilpage}{#3}%
\advance\curpage by 7%
\repeat%
\if@pdfdingsunbalance%
\advance\maxpages by 1%
\@incpdfdings{\the\maxpages}{}{\@pdfdingsmore}%
\fi%
}
\makeatother
\begin{document}
\incpdfdings[60]{B.pdf}{C.pdf}
\end{document}
答え2
2 つの PDF ファイルを 1 つに結合し、もう一度それをドキュメント C に追加する方が効率的です。JavaScript に慣れている場合は、このリンクが役立ちます。http://www.planetpdf.com/developer/article.asp?ContentID=collating_pdfs_using_javascrip&rh%20s_fa
またはこのオンラインサービス https://www.sejda.com/en/alternate-mix-pdf