【问题标题】:How to add an image as a header/footer in Markdown for a PDF document如何在 Markdown 中为 PDF 文档添加图像作为页眉/页脚
【发布时间】:2014-10-07 14:43:42
【问题描述】:

我想将图像作为页眉和页脚(与我的组织的视觉标识保持一致)添加到 PDF 报告中。我已经设法在 Sweave 中做到了,但我也希望能够只使用 Markdown 来做到这一点。我可以使用![footer](H:/R/Footer.pdf) 插入图像,但是当我尝试使用墙纸包时(就像我在 Sweave 中所做的那样),我得到一个错误。

---
title: "2014 Report"
author: "My Name"
date: "Monday, October 06, 2014"
output:
  pdf_document:
    number_sections: yes
    toc: yes
fontsize: 10pt
header-includes:
    - \usepackage{wallpaper}
abstract: This is my abstract
---
\LRCornerWallPaper{0.99}{![footer](H:/R/Footer.pdf)} 

Markdown 有办法,还是我需要坚持使用 Sweave?

【问题讨论】:

  • 我没有尝试过,但我想\LRCornerWallPaper{} 的内容需要采用 LaTeX 格式(包括图形),因为(大概)pandoc 不会尝试解释它。
  • 即使用壁纸包的LaTeX格式。我只是在 \begin{document} 之后包含它。
  • 你能添加一个最小的纯 LaTeX 工作示例吗?它似乎适用于\LRCornerWallPaper{0.99}{path\to\pic},但不适用于![footer] 选项。而且我没有在文档中找到这种用法。
  • 啊,好的。那行得通-您可以将其添加为答案吗?我正在将 Markdown 语言与 Latex 语言相结合。

标签: r markdown knitr


【解决方案1】:

在这种情况下,wallpaper 包的正确用法很简单

\LRCornerWallPaper{0.99}{path/to/pic}

【讨论】:

    猜你喜欢
    • 2020-05-04
    • 2020-02-07
    • 1970-01-01
    • 1970-01-01
    • 2013-03-09
    • 2013-09-30
    • 2015-09-02
    • 2013-05-07
    • 1970-01-01
    相关资源
    最近更新 更多