R Markdown: Putting an image in the top right hand corner of HTML and moving title down

前端 未结 2 1219
星月不相逢
星月不相逢 2020-12-15 07:48

I would like to put a company logo image in the top right hand side of my R markdown report, and then move the title down, say 3 or 4 cm lower than the default position. Th

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-15 08:29

    Option 1:

    Add this script at the beginning (or somewhere else) of your RMarkdown document:

    
    

    This will look like

    For the script to work, the image has to be in the same folder as the .Rmd document. You could also give the tag a certain id and add more precise CSS styling with

    
    

    Option 2:

    Create an extra HTML file (e.g. extLogo.html) that contains the logo like:

    Then modify the YAML header like this:

    ---
    title: "Test"
    author: "Martin Schmelzer"
    date: "13 Juli 2016"
    output: 
      html_document:
        includes:
          in_header: extLogo.html
    ---
    

    This looks like

    and might need some further margin/padding options...

提交回复
热议问题