我有以下代码:
\documentclass{book}
\usepackage{pdfpages}
\begin{document}
\chapter{chap1}
Some text.
\includepdf[pages={-},pagecommand={\thispagestyle{headings}},scale=0.7]{myfirstfile.pdf}
more text
\includepdf[pages={-},pagecommand={\thispagestyle{headings}},scale=0.7]{mysecondfile.pdf}
\chapter{chap2}
even more text
\end{document}
我希望 myfirstfile.pdf 和 mysecondfile.pdf 打印在文档末尾,位于 chap1 和 chap2 之后。有什么帮助吗?
谢谢!
答案1
您可以用\AtEndDocument
它来做这件事。
\documentclass{book}
\usepackage{pdfpages}
\AtEndDocument{\includepdf[pages={-},pagecommand={\thispagestyle{headings}},scale=0.7]{example-image-a}
\includepdf[pages={-},pagecommand={\thispagestyle{headings}},scale=0.7]{example-image-b}}
\begin{document}
\chapter{chap1}
Some text.
more text
\chapter{chap2}
even more text
\end{document}
至于你在评论中的问题:你也可以这样做
\documentclass{book}
\usepackage{pdfpages}
\newcommand{\AddGraphicsAtEnd}[2][pages={-},pagecommand={\thispagestyle{headings}},scale=0.7]{%
\AtEndDocument{\includepdf[#1]{#2}}}
\begin{document}
\chapter{chap1}
Some text.
\AddGraphicsAtEnd{example-image-a}
more text
\chapter{chap2}
even more text
\AddGraphicsAtEnd{example-image-b}
\end{document}
即只积累您想要放在最后的东西。