在 R Markdown 文件中嵌入 pdf 并调整分页

2024-04-30

我即将完成博士学位,我需要在 R Markdown 文本中间的某个位置嵌入一些论文(pdf 格式)。

将 R Markdown 转换为 PDF 时,我希望将这些 PDF 论文嵌入到转换中。

但是,我希望这些 PDF 论文也根据 Markdown 文本的其余部分进行编号。

我该怎么做?


更新:新错误

通过使用\includepdf,我收到此错误:

output file: Tesis_doctoral_-_TEXTO.knit.md

! Undefined control sequence.
l.695 \includepdf
                 [pages=1-10, angle=90, pagecommand={}]{PDF/Paper1.pdf} 
Here is how much of TeX's memory you used:
 12157 strings out of 495028
 174654 string characters out of 6181498
 273892 words of memory out of 5000000
 15100 multiletter control sequences out of 15000+600000
 40930 words of font info for 89 fonts, out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 31i,4n,35p,247b,342s stack positions out of 5000i,500n,10000p,200000b,80000s

Error: Failed to compile Tesis_doctoral_-_TEXTO.tex. See Tesis_doctoral_-_TEXTO.log for more info.
Execution halted

R Markdown 代码示例

---
title: Histología dental de los homininos de la Sierra de Atapuerca (Burgos, España)
  y patrón de estrategia de vida
author: "Mario Modesto-Mata"
date: "20 September 2018"
output:
  pdf_document:
    highlight: pygments
    number_sections: yes
    toc: yes
    toc_depth: 4
  word_document:
    toc: yes
    toc_depth: '4'
  html_document: default
csl: science.csl
bibliography: references.bib
header-includes:
- \usepackage{pdfpages}
---

```{r opciones_base_scripts, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
library(captioner)
tabla_nums <- captioner(prefix = "Tabla")
figura_nums <- captioner(prefix = "Figura")
anx_tabla_nums <- captioner(prefix = "Anexo Tabla")
```

# Resumen

Los estudios de desarrollo dental en homínidos han sido sesgados involuntariamente en especies pre-Homo y algunos especímenes Homo tempranos, que representan la condición primitiva con tiempos de formación dental más rápidos, respetan a los Neandertales posteriores y a los humanos modernos, que comparativamente tienen tiempos de formación más lentos.

## PDF Article

\includepdf[pages=1-22, pagecommand={}]{PDF/Paper1.pdf}

## Bayes

El desarrollo dental relativo se evaluó empleando un enfoque estadístico bayesiano (31).

这是下载 PDF 的链接 https://drive.google.com/file/d/1M8QkRZtTBEbmd_qjRxO79D533tQqv2wt/view?usp=sharing


新图片


我必须从你的示例中删除一些内容,但之后它就没有问题了:

---
title: Histología dental de los homininos de la Sierra de Atapuerca (Burgos, España)
  y patrón de estrategia de vida
author: "Mario Modesto-Mata"
date: "20 September 2018"
output:
  pdf_document:
    highlight: pygments
    number_sections: yes
    toc: yes
    toc_depth: 4
    keep_tex: yes
  word_document:
    toc: yes
    toc_depth: '4'
  html_document: default
header-includes:
- \usepackage{pdfpages}
---


# Resumen

Los estudios de desarrollo dental en homínidos han sido sesgados involuntariamente en especies pre-Homo y algunos especímenes Homo tempranos, que representan la condición primitiva con tiempos de formación dental más rápidos, respetan a los Neandertales posteriores y a los humanos modernos, que comparativamente tienen tiempos de formación más lentos.

## PDF Article

\includepdf[pages=1-22, pagecommand={}, scale = 0.9]{Paper1.pdf}

## Bayes

El desarrollo dental relativo se evaluó empleando un enfoque estadístico bayesiano (31).

Result:

顺便说一句,对于像论文这样的东西我会使用bookdown,因为这可以为您提供交叉引用等。

如果这对您不起作用,我建议首先查看普通 LaTeX,即以下 LaTeX 文档是否适合您:

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
foo

\includepdf[pages=1-22, pagecommand={}, scale = 0.9]{Paper1.pdf}

bar
\end{document}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 R Markdown 文件中嵌入 pdf 并调整分页 的相关文章

  • 内容处置:ASP.Net 中的内联 PDF 文件不起作用

    我正在尝试将带有标题的 PDF 文件返回到浏览器Content Dispostion inline就在我创建这个文件之后 浏览器的查看者无法打开它 文件没有损坏 如果我放入浏览器 查看器会正确显示文件 但我想一次性创建文件并检查用户对文件的
  • 从输出流合并 PDF

    我有两个 PDF 文件 每个文件都在一个ByteArrayOutputStream 我想合并两个 PDF 并且想使用 iText 但我不明白如何制作它 因为它只使用 InputStream 谁能帮我 The ByteArrayOutputS
  • 如何使用Python从pdf文件中删除页面?

    我有一些超过 500 页的 pdf 文件 但每个文件中只需要几页 有必要保留文档的标题页 我确切地知道程序应该删除的页数 如何使用安装在 MS Visual Studio 上的 Python 2 7 环境来完成此操作 尝试使用PyPDF2
  • 使用其他应用程序打开 pdf

    我正在应用程序中显示 pdf 文件 我想在 nag bar 上显示 打开方式 选项 显示 iPhone 上安装的可以打开相同 pdf 的应用程序 如果用户选择任何应用程序 例如 pdf 查看器 则应该使用 pdf 查看器应用程序打开 pdf
  • JsPdf 库无法读取 PDF 中的阿拉伯语

    在 pdf 中显示阿拉伯值的代码不起作用 它向我展示了一些我无法理解的奇怪语言 var sm nature name nature1 ar 1 name nature2 ar 2 name nature3 ar 3 name nature4
  • 带knitr的子图或子标题?

    是否可以使用 knit 生成子图 带有相关的子标题 这是一个最小的工作示例 documentclass article begin document lt
  • 是否可以使用“pandoc”将 .tex 文件编译为 PDF?

    是否可以使用 pandoc 编译 tex 文件 我目前正在使用 MacVim 在 MultiMarkdown 中记课堂笔记 这样 当我回到家时 我就可以mmd2tex并使用 TexShop 将 tex 文件编译为 PDF 它效果很好 但这个
  • 如何使用 iTextSharp 从 PDF 中提取突出显示的文本?

    根据以下帖子 iTextSharp PDF 使用 C 读取突出显示的文本 突出显示注释 https stackoverflow com questions 23342500 itextsharp pdf reading highlighed
  • 仅生成一张电子表格的 PDF

    我需要一个只用一张电子表格创建 PDF 的脚本 我目前有一个生成 PDF 的脚本 但它处理整个文件 我无法将这些值复制到另一个文件 因为我需要导出的工作表是带有从另一个工作表中提取的数据的图形 你可以帮帮我吗 谢谢 function myF
  • LaTex 中与 knit 和 xtable 交叉引用的问题

    我目前正在与 R Studio 合作 使用 LaTex 中的 R knitr 生成 PDF 文档 在这些文档中 我想在文本中引用的表格中展示我的部分结果 我使用 R 中的 xtable 包生成这些表 它运行良好并为我提供了正确的表 到目前为
  • 创建 PDF/A-3:嵌入文件应包含有效的 Params 密钥

    我正在尝试使用 itextpdf 5 4 5 和 itext pdfa 5 4 5 创建 PDF A 3 当我设置 PdfFileSpecification 时 出现以下异常 com itextpdf text pdf PdfAConfor
  • 检测文本字段溢出

    假设我有一个 PDF 文档 其中的文本字段定义了某种字体和大小 有没有办法确定某些文本是否适合字段矩形内PDFBox 我试图避免文本未完全显示在字段内的情况 因此 如果给定字体和大小的文本溢出 我想将字体大小更改为Auto 0 此代码重新创
  • 如何使用 LaTeX 绘制圆 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我想在Latex中画一个有6个等距点的圆 标记为1 6然后连接点1 点2 点3 有谁知道怎么画吗 谢谢 您可以利用the tikz lib
  • 组织模式下的内联代码

    Markdown 允许embedded code 这怎么能在org mode 我了解源代码块 begin example blah blah end example 但我想要的是这样的 显然 具有正确的语法 我不知道 This is emb
  • 如何使用间隙分隔pdf中的段落?

    我有一些 pdf 文件 每页有 2 3 个段落 每个段落都由一些行间隙分隔 但是在使用 pymupdf 阅读时 我看不到段落之间有任何机器可打印的分隔符 还有其他方法吗 其他图书馆可以做到这一点吗 code import fitz from
  • 使用 PDFBox 在 PDF 上绘制矢量图像

    我想使用 Apache PDFBox 在 PDF 上绘制矢量图像 这是我用来绘制常规图像的代码 PDPage page PDPage document getDocumentCatalog getAllPages get 1 PDPageC
  • 基于 Microsoft Word 模板生成 PDF 文档 [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我需要一个 Word 文档 它是某种模板 收集用户输入以填充该模板中的特定字段 然后生成一个 PDF
  • 带有用户输入的knitr

    我正在使用 R markdown 并使用 Rstudio 来 Knit 我有以下 R markdown 文件 title Untitled author date output html document r setup include F
  • markdown/pandoc 的全站编译? [关闭]

    Closed 此问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 With Sphinx doc http sphinx doc org 您可以创建一堆 ReStruct
  • 如何将pdf页面设置设置为打印属性对话框?

    大家好 我想知道如何设置 pdf 页面设置到打印属性对话框 例如 如果我的 PDF 页面设置为横向 则布局会自动显示横向而不是纵向 如果我的 PDF 页面设置为纵向 则布局会自动显示纵向 我在这个主题上做了很多研发 但没有找到任何满意的链接

随机推荐