【发布时间】:2011-02-13 21:55:19
【问题描述】:
我正在尝试在我的 LaTeX 文件中插入 PDF 或 doc 文件作为附录。你知道我该怎么做吗?
【问题讨论】:
-
您只是附加 pdf,还是想像图片一样嵌入它?
-
请注意建议我们将其迁移到 text.stackexchange - 我们不能。它是从 2010 年开始的,这使得它太旧而无法迁移。
我正在尝试在我的 LaTeX 文件中插入 PDF 或 doc 文件作为附录。你知道我该怎么做吗?
【问题讨论】:
\includegraphics 函数有一个page 选项,用于将 PDF 文件的特定页面插入为图形。默认值为 1,但您可以更改它。
\includegraphics[scale=0.75,page=2]{multipage.pdf}
您可以找到更多here。
【讨论】:
使用pdfpages 包。
\usepackage{pdfpages}
要包含 PDF 文件中的所有页面:
\includepdf[pages=-]{myfile.pdf}
仅包含 PDF 的第一页:
\includepdf[pages={1}]{myfile.pdf}
在 shell 中运行 texdoc pdfpages 以查看 pdfpages 的完整手册。
【讨论】:
\includepdf[pages={1,3,5}]{myfile.pdf} 将包含文件的第 1、3 和 5 页。要包含整个文件,请指定pages={-},其中{-} 是一个没有指定端点的范围,默认分别为第一页和最后一页。
\includepdf[pages=-,scale=.8,pagecommand={}]{file}跨度>
\includepdf[page={-},offset=<offset in x>mm <offset in y>mm]{myfile.pdf}
pages={1-48,50-100}。不像pages={!49} 这样简单,但也没有那么困难。
有一个选项可以在 pdflatex 下运行,无需额外的软件包
修改此代码
\begin{figure}[h]
\centering
\includegraphics[width=\ScaleIfNeeded]{figuras/diagrama-spearman.pdf}
\caption{Schematical view of Spearman's theory.}
\end{figure}
“diagrama-spearman.pdf”是使用 TikZ 生成的图,这是代码(它是另一个 .tex 文件,与我要插入 pdf 的 .tex 文件不同)
\documentclass[border=3mm]{standalone}
\usepackage[applemac]{inputenc}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage[bb=lucida,bbscaled=1,cal=boondoxo]{mathalfa}
\usepackage[stdmathitalics=true,math-style=iso,lucidasmallscale=true,romanfamily=bright]{lucimatx}
\usepackage{tikz}
\usetikzlibrary{intersections}
\newcommand{\at}{\makeatletter @\makeatother}
\begin{document}
\begin{tikzpicture}
\tikzset{venn circle/.style={draw,circle,minimum width=5cm,fill=#1,opacity=1}}
\node [venn circle = none, name path=A] (A) at (45:2cm) { };
\node [venn circle = none, name path=B] (B) at (135:2cm) { };
\node [venn circle = none, name path=C] (C) at (225:2cm) { };
\node [venn circle = none, name path=D] (D) at (315:2cm) { };
\node[above right] at (barycentric cs:A=1) {logical};
\node[above left] at (barycentric cs:B=1) {mechanical};
\node[below left] at (barycentric cs:C=1) {spatial};
\node[below right] at (barycentric cs:D=1) {arithmetical};
\node at (0,0) {G};
\end{tikzpicture}
\end{document}
这是我包含的图表
【讨论】:
\includegraphics[page=2,width=0.5\textwidth,height = 0.3\textheight]{file.pdf}
要将整个 pdf 放入文件中,而不仅仅是 1 页,请使用:
\usepackage{pdfpages}
\includepdf[pages=-]{myfile.pdf}
【讨论】:
我认为不会有自动的方法。您可能还想在附录中正确添加页码。假设您已经拥有多页的 pdf 文档,您必须首先使用 Adobe Acrobat Professional 提取 pdf 文档的每一页,并将它们中的每一个保存为单独的 pdf 文件。然后,您必须在每页(每页 1 个)上将每个 pdf 文档包含为图像,并在每页之间使用 newpage,例如,
\appendix
\section{Quiz 1}\label{sec:Quiz}
\begin{figure}[htp] \centering{
\includegraphics[scale=0.82]{quizz.pdf}}
\caption{Experiment 1}
\end{figure}
\newpage
\section{Sample paper}\label{sec:Sample}
\begin{figure}[htp] \centering{
\includegraphics[scale=0.75]{sampaper.pdf}}
\caption{Experiment 2}
\end{figure}
现在每页将显示每页 1 个 pdf 图像,并且您将在底部有一个正确的页码。如我的示例所示,您必须对每个图像的比例因子进行一些调整,以使其具有适合单个页面的正确尺寸。希望对您有所帮助...
【讨论】:
\includegraphics{myfig.pdf}
【讨论】:
\usepackage{graphicx} 才能使用此命令