如何从 Rmarkdown 中的 .tex 文件夹(相对路径)中获取图像? [英] How to get images from the .tex folder (relative path) in Rmarkdown?

查看:16
本文介绍了如何从 Rmarkdown 中的 .tex 文件夹(相对路径)中获取图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取像这里这样的水印图像:

解决方案

我刚做了.

问题出在 MiKTeX for Windows 上.

我只是按照 this answer 上的步骤操作,记住要确保该文件夹符合 TDS(带有 tex 文件夹),然后我将图像放在 tex 文件夹中.

I'm trying to get a watermark image like here:

How to add a watermark image on rmarkdown?

I almost did it, but as I wrote on my original question the background.png image that the includegraphics get comes from C:Program Files (x86)MiKTeX 2.9 explainpresent

I'm currently using my Latex code from an external file using the follwing at beginning of my .Rmd:

output:
  pdf_document:
    includes:
      in_header: header.tex

And in header.tex I'm using the following code:

usepackage{eso-pic,graphicx,transparent}
AddToShipoutPictureFG{
put(0,0){%
parbox[b][paperheight]{paperwidth}{%
centering
  {	ransparent{0.3} includegraphics[width=paperwidth,height=paperheight,%
keepaspectratio]{background.png}}%
    }
  }
}

But I just can't get the background.png from where my .tex file is (that is the same that my .Rmd file is).

How I tell to my .tex file get this image from the relative path to my .tex?

--EDIT-- I'm using the render function from rmarkdown to make the report, follow is a screenshot from the insides of my folder with .Rmd, the .tex file and the error when I try to insert a test.png:

解决方案

I just did it.

The problem were on MiKTeX for Windows.

I just followed the steps on this answer, remembering to assure that the folder is TDS-compliant (with a tex folder in it), and after I just put the image on the tex folder.

这篇关于如何从 Rmarkdown 中的 .tex 文件夹(相对路径)中获取图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆