【问题标题】:Vim + latex-suite - modify output file nameVim + latex-suite - 修改输出文件名
【发布时间】:2021-12-10 02:39:10
【问题描述】:

我想创建一个自定义编译规则,它接受 foo.tex 并输出 foo_bar.pdf

我在我的 texrc 中使用了以下配置,但我没有找到从输出名称中排除 .tex 扩展名的方法。

TexLet g:Tex_CompileRule_bar = 'pdflatex -interaction=nonstopmode -file-line-error-style -halt-on-error -jobname=%_bar $*'

结果:foo.tex_bar.pdf

TexLet g:Tex_CompileRule_bar = 'pdflatex -interaction=nonstopmode -file-line-error-style -halt-on-error -jobname=$*_bar $*'

结果:foo.tex_bar.pdf

TexLet g:Tex_CompileRule_bar = 'pdflatex -interaction=nonstopmode -file-line-error-style -halt-on-error -jobname=bar_$ $*'

结果:bar_$.tex

【问题讨论】:

  • 太棒了,成功了!我意识到我的无知正在表现出来,但我想了解该语法的来源?它是 RegExp 的一部分吗?
  • 作为答案发布,包含更多详细信息和对文档的参考。

标签: vim latex pdflatex


【解决方案1】:

您可以在% 之后使用:r 文件名修饰符删除其扩展名,然后再添加新后缀。文件名修饰符通常在支持% 的上下文中工作(例如使用:! 运行外部shell 命令。)

在你的情况下,-jobname=%:r_bar 应该可以完成这项工作。

请参阅 :help filename-modifiers 了解完整的修饰符列表及其工作原理。

【讨论】:

    猜你喜欢
    • 2015-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多