如何解决如何在Sphinx + Latex Pdf文件中包含图像文件
我正在使用Sphinx文档工具和LaTeX来生成pdf文件。
LaTeX Warning: File `{img_file}.jpg' not found on input line 920.
! Package pdftex.def Error: File `"""{img_file}".jpg' not found: using dra
ft setting.
See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
...
l.920 ...phinxincludegraphics{{img_file}.jpg}
}
?
以下是一些关键的环境变量:
A。。在我的 conf.py 中,我已将绝对路径定义为:sys.path.insert(0,os.path.abspath('..'))
B。这是目录树:
docs/ # (Sphinx) Documentation folder
_build/
_static/
css/
images/
abc.jpg
img_file.jpg <= This image file is in the root ("_static") directory
_templates/
conf.py
index.rst
modules/ <= Folder containing my source (.rst) files
execute/
file_with_image.rst <= I am trying to put the image in this source file
some_other_file.rst
.. image:: /_static/img_file.*
D。。我在 {em}前言”中加入了 graphix 。
为什么会出现此错误?错误消息中如此多的“”引号的来源是什么?
编辑
在 Tex 编辑器中打开conf.py
文件时,图像插入部分的代码片段显示如下:
*.tex
使用\subsection{Add Image}
\label{\detokenize{modules/aud_execution/add_image_with_image_directive:add-image}}\label{\detokenize{modules/aud_execution/add_image_with_image_directive::doc}}
\sphinxstylestrong{Adding an image}
Example of image usage using “image” directive:
\noindent{\hspace*{\fill}\sphinxincludegraphics{{img_file}.jpg}} % ***
,编辑器将引发错误,如下所示:
但是,当图像文件名中的大括号Quick Build
被删除并将其更改为(标有***的行)时:
{{img_file}.jpg}
%***
文档成功编译,可以在pdf文件中看到图像。
如果保存了 \noindent{\hspace*{\fill}\sphinxincludegraphics{img_file.jpg}}
文件,则 _build / latex / 文件夹中的pdf文件将显示图像。
那为什么要在.tex
期间从终端插入多余的括号?
解决方法
请勿将图片放在_static
下。这是专用文件夹,不适用于图像。例如。创建modules/execute/img/
,在其中移动图片,然后.. image:: img/my-image.png
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。