Forgot password
 Register account
View 3643|Reply 1

能不能在文档中直接引用文档的名字?

[Copy link]

414

Threads

1641

Posts

15

Reputation

Show all posts

abababa posted 2014-10-6 14:26 |Read mode
例如我现在打一篇名为“三角形的五心.tex”的文档,在文档中有一些地方引用了文档名字,就是“三角形的五心”这几个字,之后我把文档改名了,我想不修改内容,让文档里面的那些引用自动把名字改成文档的新名字,有没有什么方法能做到呢?
我已经试过在文档中新定义一个变量,然后只改动这一处就可以了,有没有除此之外的方法,就是自动获取文档名字不需要定义什么东西的。

414

Threads

1641

Posts

15

Reputation

Show all posts

original poster abababa posted 2025-5-18 13:15
hbghlyj 发表于 2025-5-18 12:20
可以使用 LaTeX 的 \jobname 命令。例:

会自动显示当前编译的文件名(不包括扩展名)。 ...
已经用了\usepackage{currfile}这个了,用\currfilename来引用当前文档的名字。这样以后文档内的label可以都加上这个前缀,就不会重复了

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-20 13:31 GMT+8

Powered by Discuz!

Processed in 0.010849 seconds, 22 queries