Insert a logo in upper right corner of R markdown pdf document

后端 未结 5 1476
挽巷
挽巷 2020-12-01 03:21

I am getting started with R markdown and I would like to create a new report having our company image logo.png in the upper right corner of each page.

I

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 03:31

    I've tried many solutions presented here and in other forums, none of which worked. I've finally came to a solution that worked for me.

    ---
    title: 'Fancy Title Here'
    author: "Diego"
    date: "today"
    output:
      pdf_document:
        toc: yes
    header-includes:
        - \usepackage{fancyhdr}
    ---
    \addtolength{\headheight}{1.0cm} % make more space for the header
    \pagestyle{fancyplain} % use fancy for all pages except chapter start
    \rhead{\includegraphics[height=1.2cm]{C:/Path/to/logo/logo}} % right logo
    \renewcommand{\headrulewidth}{0pt} % remove rule below header
    

    I hope that helps someone the same way it helped me.

提交回复
热议问题