在 LaTeX 中,有没有办法将图形的文件名包含到标题中?
我有一个 LaTeX 文档,其中包含来自 \includegraphics{bla.pdf}
的外部文件的大量绘图。绘图是在 Inkscape 中完成的。这一切都很好。然而,有时很难跟踪所有图纸及其源文件。因此,我正在寻找一种将源文件名(在示例 bla.pdf
中)包含到标题中的方法。作为一名 LaTeX 专家,我还没有找到一种方法来自动访问标题中的文件名字符串。使用 Google-foo 也没有产生结果。是否有现有的方法来引用文件名并将其包含在标题中,例如 \caption{A fancy Drawing of bla (\filename}
?
I have a LaTeX document with a large number of drawings included from external files with \includegraphics{bla.pdf}
. The drawings are done in Inkscape. This all works fine. However sometimes it is hard to keep track of all the drawings and their source files. Hence I'm looking for a way to include the source file name, in the example bla.pdf
, into the caption. Not being a LaTeX expert I haven't found a way to automatically access the filename string from the caption. Using Google-foo didn't yield a result either. Is there an existing way to refer to the filename and include it in the caption, like \caption{A fancy drawing of bla (\filename}
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过修补
\includegraphics
内的部分嵌套调用来捕获图像文件名:\imgfilename
将包含\includegraphics
仅在使用后使用。You can capture the image filename by patching a part of the nested calls inside
\includegraphics
:\imgfilename
will contain the filename used in\includegraphics
only after it's used.重新定义
\includegraphics
。对于没有参数的情况(宽度=3厘米,比例=2或类似的东西),我们有使用
Redefine
\includegraphics
. For the case of no arguments (width=3cm, scale=2 or something like this) we haveThe use