问题描述
我正在尝试获取像这样的水印图像:
I'm trying to get a watermark image like here:
我几乎做到了,但是正如我在最初的问题上所写的那样,\includegraphics
获取的background.png
图片来自C:\Program Files (x86)\MiKTeX 2.9\tex\plain\present
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\tex\plain\present
我目前正在使用外部文件中的Latex代码,其后缀为.Rmd:
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
在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
{\transparent{0.3} \includegraphics[width=\paperwidth,height=\paperheight,%
keepaspectratio]{background.png}}%
}
}
}
但是我只是无法从我的.tex
文件所在的位置获取background.png
(与我的.Rmd
文件所在的位置相同).
But I just can't get the background.png
from where my .tex
file is (that is the same that my .Rmd
file is).
我如何告诉我的.tex
文件从我的.tex
的相对路径获取此图像?
How I tell to my .tex
file get this image from the relative path to my .tex
?
-编辑-我正在使用rmarkdown
中的render
函数制作报告,以下是我的文件夹中带有.Rmd,.tex文件和尝试插入test.png
时出现的错误的屏幕截图:
--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
:
推荐答案
我刚刚做到了.
问题出在Windows的MiKTeX上.
The problem were on MiKTeX for Windows.
我只是按照此答案上的步骤操作,记得要确保该文件夹符合TDS要求(tex
文件夹中),然后将图像放在tex
文件夹中.
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文件夹(相对路径)获取图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!