将一个文档剪辑到另一个文档中

将一个文档剪辑到另一个文档中

我想将一个文档包含到另一个文档中。应该包含的文档以 pdf 和 tex 文件的形式存在。我想包含的文档大约有 30 页。我想以下面描述的方式包含该文档。

所包含的文档周围应该有边框。此外,由于 documentclass 文章的原因,子文档文本周围有很多空白。这些空白可以删除。这样文本就会从边框附近开始(见屏幕截图)。由于子文档包含大量图形和 tikz 绘图,因此仅缩小文档的大小/格式并不那么简单。因为这会对图形产生影响,图形会太小。

期望的结果

我的主文档标题的简短摘录:

\documentclass[paper=A4,abstracton,twoside,openright,11pt,headsepline,BCOR=1cm,DIV=10,utf8]{scrreprt}
\begin{document}

\appendix
    %here should be my included document

\end{document}

我的子文档的一个示例:

\documentclass[11pt]{article}
\usepackage{geometry}
%i have done this, to clip the white space around
\geometry{a4paper, top=10mm, left=10mm, right=10mm, bottom=10mm,headsep=10mm, footskip=5mm}
%...
\begin{document}
example text example text example text example text example text example text  example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text example text 
\end{document}

答案1

OP 的一条评论说

我用 包含了我的 pdf \includepdf[pages={1-},frame,scale=0.8]{sub/subdocument.pdf}。我用 geometry 包删除了子文档周围的空白。但主文档中的页码(见上面的屏幕截图)仍然丢失。我该如何实现?

main document页码的问题是由于默认pdfpage's选项造成的。pagecommandpagecommand={\thispagestyle{empty}}

强制执行新的操作pagecommand将解决问题:

\documentclass[paper=A4,abstracton,twoside,openright,11pt,headsepline,BCOR=1cm,DIV=10,utf8]{scrreprt}
\usepackage{pdfpages}
\begin{document}

\appendix
    %here should be my included document
    \includepdf[pages={1-},frame,scale=0.8, 
          pagecommand={}]%  <---------- doesn't change `pagestyle`
          {arsclassica/ArsClassica.pdf}
\end{document}

在此处输入图片描述

答案2

如果有人想要纯 TiZ 框架,就是这个。
(注意,即使是剪辑也是在 Ti 中完成的Z.)

\documentclass{scrreprt}
\usepackage{tikz}
\usetikzlibrary{calc,spy}
\begin{document}

\appendix
\chapter{Special Package}

\pgfdeclarelayer{back}
\pgfdeclarelayer{fore}
\pgfsetlayers{back,main,fore}
\tikzset{
    on layer/.code={\pgfonlayer{#1}\begingroup\aftergroup\endpgfonlayer\aftergroup\endgroup}
}
\clearpage
\tikz[remember picture,overlay]{
    \scoped\clip[rounded corners=20,postaction={on layer=fore,line width=10,draw}]($(current page.south west)+(2,7)$)rectangle($(current page.north east)+(-2,-7)$)(current page)node{\includegraphics[page=1]{tikz-3dplot_documentation}};
    \draw[<-,red,line width=2,bend right](current page)++(4,2)to++(2,10)node[above]{\Huge Notice This};
}
\clearpage
\tikz[remember picture,overlay,spy using outlines={circle,magnification=4,size=4cm,connect spies}]{
    \scoped\clip[rounded corners=20,postaction={on layer=fore,line width=10,draw}]($(current page.south west)+(2,7)$)rectangle($(current page.north east)+(-2,-7)$)(current page)node{\includegraphics[page=2]{tikz-3dplot_documentation}};
    \spy[red]on(5,-15)in node at(4,-23);
}
\clearpage
\tikz[remember picture,overlay]{
    \scoped\clip[rounded corners=20,postaction={on layer=fore,line width=10,draw}]($(current page.south west)+(2,7)$)rectangle($(current page.north east)+(-2,-7)$)(current page)node{\includegraphics[page=3]{tikz-3dplot_documentation}};
    \fill($(current page)+(-6,-2.3)$)rectangle node[white]{\Huge Censored}($(current page)+(6,-.6)$);
}
\clearpage
\tikz[remember picture,overlay]
{
    \scoped\clip[rounded corners=20,postaction={on layer=fore,line width=10,draw}]($(current page.south west)+(2,7)$)rectangle($(current page.north east)+(-2,-7)$)(current page)node{\includegraphics[page=4]{tikz-3dplot_documentation}};
    \fill[on layer=back,yellow]($(current page)+(-6.1,.8)$)rectangle($(current page)+(6,-1.7)$)node[below left,olive]{\Huge Important};
}
\clearpage
\tikz[remember picture,overlay]
{
    \clip[draw](current page)circle(5);
    \scoped\clip[rounded corners=20,postaction={on layer=fore,line width=10,draw}]($(current page.south west)+(2,7)$)rectangle($(current page.north east)+(-2,-7)$)(current page)node{\includegraphics[page=5]{tikz-3dplot_documentation}};
}
\clearpage
\tikz[remember picture,overlay]
{
    \scoped\clip[rounded corners=20,postaction={on layer=fore,line width=10,draw}]($(current page.south west)+(2,7)$)rectangle($(current page.north east)+(-2,-7)$)(current page)node{};
}
\vfill
\Huge\it This page is intentionally left blank.

\end{document}

答案3

您要包含的文档不是双面的。因此,您可以执行相同的每页剪辑来修剪多余的空白(边距),并使用简单的方法包含每页\includegraphics

\documentclass{article}
\usepackage{multido,graphicx,lipsum}
\begin{document}

\section{Introduction}
\lipsum[1-10]

\section{Appendix}

% https://tex.stackexchange.com/q/198091/5764
\pdfximage{lipsum50.pdf}% Contains 50 pages of \lipsum text
\multido{\i=1+1}{\the\pdflastximagepages}{%
  \fbox{\includegraphics[scale=.5,page=\i,viewport=50 40 565 750,clip]{lipsum50}}%
  \clearpage}

\end{document}

该解决方案的原理是计算文档的页数要包含的内容,然后使用框架对每个页面进行迭代\includegraphicsviewport设置为仅包含每个页面的相关部分,clipping 页边距。您可能需要使用这些viewport值(它们在bp)。

相关内容