在 LaTeX 中使用 pdfpages 时,如何避免在第一页之前分页?
我正在创建一个大型 LaTeX 文档,我的附录中有几本 PDF 格式的小册子的复制品。我正在尝试创建一个节标题,然后以稍低的比例包含页面。例如:
\section{Booklet about Yada Yada Yada}
\includepdf[pages={-}, frame=true, scale=0.8]{booklet_yadayada.pdf}
然而,pdfpagex 做了两件烦人的事情。首先,它为包含的文档页面提供一个输出文档页面。我可以接受这一点,因为我使用的是 80% 的比例。然而,主要问题是第一页也是一个新页面,所以我有一个页面只有一个部分标题,然后是一个带有小册子的单独页面。
有没有办法让 pdfpages 变得更聪明一点?
I am creating a large LaTeX document, and my appendix has reproductions of several booklets that I have as PDFs. I am trying to create a section header and then include the pages at a slightly lower scale. For example:
\section{Booklet about Yada Yada Yada}
\includepdf[pages={-}, frame=true, scale=0.8]{booklet_yadayada.pdf}
However, pdfpagex does two annoying things. First, it devotes one output document page for included document page. I can live with that as I am using 80% scale. The main problem, however, is that the first page is also a new page, so I have a page with just a section title, and then a separate page with the booklet.
Is there some way to get pdfpages to be a little smarter here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
\includepdf
在内部使用\includegraphics
,因此类似的内容会包含页面而无需开始新页面,尽管它一次只处理一页。
\includepdf
uses\includegraphics
internally, so something likewould include the page without starting a new one, although it only does one page at a time.
对我来说,以下方法效果很好:
For me the following worked just fine:
我也尝试了这个解决方案,但是
\includepdf
保留了在边距上输出文件的优势(输出从页面边缘居中)。所以我打开 pdfpages.sty,然后搜索
\newpage
命令。我删除了第一次出现的情况(第326行),只是为了尝试,保存后再次编译,就不再出现分页符了。I tried this solution too, but
\includepdf
keeps the advantage of outputting the file over the margin (the output is centered from the edges of the page).So I openned pdfpages.sty, and I searched for
\newpage
command. I deleted the first occurance (line 326), just to try, and after saving then compiling again, there were no page break anymore.使用 minipage 环境:
它不会添加任何额外的页面,并且可以与 includepdf 一起使用。
Use the minipage environement :
It doesn't add any extra page and it works with includepdf.
感谢您的所有答案 - 我一生都无法弄清楚
\includepdf
使用什么逻辑来插入空白页;通过\includegraphics
包含第一页的技巧解决了大部分(但不是全部)这些问题;所以这里有一些注意事项:首先,出于好奇,我也尝试仅使用
\includepdf
,但分为两部分:...不幸的是,这与OP中的问题有相同的问题。
\newpage
(<代码>pdfpages.sty)。我尝试阅读源代码,但发现很难;所以我尝试暂时将\newpage
设置为\relax
仅适用于\includepdf
- 这会将文档中的所有页面放在彼此之上;所以盲目地摆脱\newpage
可能不是一个好主意。\includegraphics[page=1,scale=0.8]{foo.pdf}
有效 - 但是(如 @ WASE 还请注意)它与页面正文的左上角对齐,也就是说在页边距内;对于整页,我们希望 pdf 内容覆盖在整个页面上,包括边距。此页面:graphics - 如何使用 TikZ 在左上角添加图像,graphicx - TeX - LaTeX 指出了在页面边缘上方定位的几种可能性;但对我来说,包含整页 PDF 的最佳解决方案是使用包
tikz
将其居中到页面:完成此操作后,作为奖励,我还体验到了:
pax
,则数据似乎也包含在\includegraphics
独立首页中,因此没有区别pdfpages
,其中第一页的上述分割位于\includegraphics
中,现在(看起来)将正确插入\cleardoublepages< 的等效内容/code> 连续包含的 pdf 之间(因此我不必手动插入这样的命令)。
希望这对某人有帮助,
干杯!
Thanks for all the answers - I couldn't for the life of me figure out what logic
\includepdf
uses to insert blank pages; the trick with including the first page via\includegraphics
solved most (but not all) of those problems; so here are some notes:First, out of curiosity, I have also tried to use only
\includepdf
, but split in two parts:... unfortunately, this has the same problem as the question in OP.
\newpage
s in the source (pdfpages.sty
). I tried reading the source, but I found it quite difficult; so I tried temporarily setting\newpage
to\relax
only for\includepdf
- and that puts all pages in the document on top of each other; so probably not a good idea to get rid of\newpage
blindly.\includegraphics[page=1,scale=0.8]{foo.pdf}
works - but (as @WASE also note) it is aligned at the top-left corner of the page body, which is to say inside the margins; for a full page we'd want the pdf inclusion overlaid over the whole page, margins included.This page: graphics - How do I add an image in the upper, left-hand corner using TikZ and graphicx - TeX - LaTeX points to several possibilities for positioning on page over the margins; but for me, the best solution for a full page PDF inclusion is to use package
tikz
to center it to the page:After this is done, as a bonus, I have also experienced:
pax
, the data seems to be included also for the\includegraphics
standalone first page, so no difference therepdfpages
, with the above split of the first page in\includegraphics
, will now (seemingly) correctly insert the equivalent of\cleardoublepages
between pdfs that are included back to back (so I don't have to insert such a command manually).Hope this helps someone,
Cheers!
我有点晚了,但以下解决方案对我有用:
所有页面均导入、缩放并旋转 90 度。
与 Texmaker 5.0.4 配合使用
I'm a little late, but the following solution worked for me:
All pages are imported, scaled and rotated by 90 degrees.
Works with Texmaker 5.0.4