【问题标题】:How to add image underneath title on title page?如何在标题页的标题下方添加图像?
【发布时间】:2019-06-10 20:37:57
【问题描述】:

我正在写一份数据分析报告。在我的封面上,我想在标题下方和作者上方的空白处插入一张图片。

我的代码如下所示。

    ---
    title: \vspace{1in}"Title"
    header-includes:
    - \usepackage{fancyhdr}
    - \usepackage{titling}
    - \pretitle{\begin{center}\LARGE\includegraphics[width=2cm, height=3cm]{logo.png}\\[\bigskipamount]}
    - \posttitle{\end{center}}
    - \fancyfoot[C]{Insert Department Name Here}
    - \fancypagestyle{plain}{\pagestyle{fancy}}
    author:
    - \vspace{4in}
    - \emph{Author}
    - \emph{optional Author 2 or contact information}
    date: \vspace{1in}\emph{Date}
    geometry: left=.5in,right=.5in,top=1in,bottom=1in
    mainfont: Times New Roman
    output: 
      pdf_document: 
        highlight: tango
        toc: true 
        toc_depth: 4
        number_sections: true
        fig_caption: true
        df_print: kable
    fontsize: 11pt
    ---

它生成以下输出:

由于我已成功添加徽标,因此我尝试将相同行的副本放在我的代码中的不同位置,但我要么收到错误提示它无法编译(当我尝试编织到 pdf 时)或者图像不显示。

【问题讨论】:

    标签: r pdf latex yaml r-markdown


    【解决方案1】:

    为了尽可能简单,请使用subtitle

    ---
    output:
      pdf_document: 
        keep_tex: true
    title: "Test"
    subtitle: "\\includegraphics{unnamed.png}\\vspace{4in}"
    author: "Martin \\vfill University of Duisburg-Essen \\newpage"
    ---
    

    【讨论】:

    • 由于某种原因,我的 pdf 中没有显示字幕。代码可以编译,但无论我在字幕中输入什么(例如字符串、图像),它都不会出现在 pdf 输出中。我是否需要下载一些额外的软件包才能使字幕功能正常工作?
    • 你确定缩进是正确的吗?你还在导入所有的 tex 包吗?
    • 啊,是的。我发现了这个问题;原来它与我编码的另一个风格元素冲突,因为我忘记指定垂直空间。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-27
    • 2015-06-06
    • 1970-01-01
    • 1970-01-01
    • 2016-01-12
    相关资源
    最近更新 更多